File Details
the-bone-1.0.0_formal-1.20.5.jar
- R
- Apr 11, 2025
- 44.42 KB
- 7
- 1.20.5
- Fabric
File Name
the-bone-1.0.0_formal.jar
Supported Versions
- 1.20.5
Curse Maven Snippet
reporter:To avoid potential discrepancies with the intended meaning, no English changelog is provided here. Please translate it yourself.
MOD名称:The Bone-1.20.5
MOD_ID:the-bone
开发者:J_pc(中国大陆,PRC)
此版本基于1.0.0_formal版本,将模组适用版本升级为1.20.5;由于1.20.5版本中部分方法被重写,以下是相关代码:
(1.20):
{
"type": "minecraft:crafting_shaped",
"category": "item/building",
"pattern":[
"** ",
"** ",
" "
],
"key": {
"*": {
"item": "minecraft:bone_block"
}
},
"result": {
"item": "the-bone:marrow",
"count": 1
}
}
--
{
"type": "minecraft:crafting_shaped",
"category": "item/building",
"pattern":[
"* ",
" ",
" "
],
"key": {
"*": {
"item": "the-bone:marrow"
}
},
"result": {
"item": "minecraft:bone_meal",
"count": 36
}
}
--
{
"type": "minecraft:crafting_shaped",
"category": "item/building",
"pattern":[
" *#",
"* #",
" *#"
],
"key": {
"*": {
"item": "minecraft:bone"
},
"#": {
"item": "minecraft:string"
}
},
"result": {
"item": "the-bone:bone_bow",
"count": 1
}
}
--
package com.example.item.custom;
import java.util.function.Predicate;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PersistentProjectileEntity;
import net.minecraft.item.*;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.stat.Stats;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
import net.minecraft.world.World;
public class Bone_Bow extends RangedWeaponItem implements Vanishable {
public static final int TICKS_PER_SECOND = 20;
public static final int RANGE = 15;
public Bone_Bow(Item.Settings settings) {
super(settings);
}
@Override
public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) {
if (user instanceof PlayerEntity playerEntity) {
boolean bl = playerEntity.getAbilities().creativeMode || EnchantmentHelper.getLevel(Enchantments.INFINITY, stack) > 0;
ItemStack itemStack = playerEntity.getProjectileType(stack);
if (!itemStack.isEmpty() || bl) {
if (itemStack.isEmpty()) {
itemStack = new ItemStack(Items.ARROW);
}
int i = this.getMaxUseTime(stack) - remainingUseTicks;
float f = getPullProgress(i);
if (true) {
boolean bl2 = bl && itemStack.isOf(Items.ARROW);
if (!world.isClient) {
ArrowItem arrowItem = (ArrowItem)(itemStack.getItem() instanceof ArrowItem ? itemStack.getItem() : Items.ARROW);
PersistentProjectileEntity persistentProjectileEntity = arrowItem.createArrow(world, itemStack, playerEntity);
persistentProjectileEntity.setVelocity(playerEntity, playerEntity.getPitch(), playerEntity.getYaw(), 0.0F, f * 9.0F, 0.0F);
if (f == 0.25F) {
persistentProjectileEntity.setCritical(true);
}
int j = EnchantmentHelper.getLevel(Enchantments.POWER, stack);
if (j > 0) {
persistentProjectileEntity.setDamage(persistentProjectileEntity.getDamage() + (double)j * 0.5 + 0.5);
}
int k = EnchantmentHelper.getLevel(Enchantments.PUNCH, stack);
if (k > 0) {
persistentProjectileEntity.setPunch(k);
}
if (EnchantmentHelper.getLevel(Enchantments.FLAME, stack) > 0) {
persistentProjectileEntity.setOnFireFor(100);
}
stack.damage(1, playerEntity, p -> p.sendToolBreakStatus(playerEntity.getActiveHand()));
if (bl2 || playerEntity.getAbilities().creativeMode && (itemStack.isOf(Items.SPECTRAL_ARROW) || itemStack.isOf(Items.TIPPED_ARROW))) {
persistentProjectileEntity.pickupType = PersistentProjectileEntity.PickupPermission.CREATIVE_ONLY;
}
world.spawnEntity(persistentProjectileEntity);
}
world.playSound(
null,
playerEntity.getX(),
playerEntity.getY(),
playerEntity.getZ(),
SoundEvents.ENTITY_ARROW_SHOOT,
SoundCategory.PLAYERS,
1.0F,
1.0F / (world.getRandom().nextFloat() * 0.4F + 1.2F) + f * 0.5F
);
if (!bl2 && !playerEntity.getAbilities().creativeMode) {
itemStack.decrement(1);
if (itemStack.isEmpty()) {
playerEntity.getInventory().removeOne(itemStack);
}
}
playerEntity.incrementStat(Stats.USED.getOrCreateStat(this));
}
}
}
}
public static float getPullProgress(int useTicks) {
float f = (float)useTicks / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if (f > 1.0F) {
f = 1.0F;
}
return f;
}
@Override
public int getMaxUseTime(ItemStack stack) {
return 216000;
}
@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.BOW;
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
ItemStack itemStack = user.getStackInHand(hand);
boolean bl = !user.getProjectileType(itemStack).isEmpty();
if (!user.getAbilities().creativeMode && !bl) {
return TypedActionResult.fail(itemStack);
} else {
user.setCurrentHand(hand);
return TypedActionResult.consume(itemStack);
}
}
@Override
public Predicate<ItemStack> getProjectiles() {
return BOW_PROJECTILES;
}
@Override
public int getRange() {
return 100;
}
}
(1.20.5):
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"group": "boneblock",
"key": {
"*": {
"item": "minecraft:bone_block"
}
},
"pattern":[
"** ",
"** "
],
"result":{
"count": 1,
"id": "the-bone:marrow"
}
}
--
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"group": "marrow",
"key": {
"*": {
"item": "the-bone:marrow"
}
},
"pattern":[
"* ",
" ",
" "
],
"result":{
"count": 36,
"id": "minecraft:bone_meal"
}
}
--
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"group": "bonebow",
"key": {
"*": {
"item": "minecraft:bone"
},
"#": {
"item": "minecraft:string"
}
},
"pattern":[
" *#",
"* #",
" *#"
],
"result":{
"count": 1,
"id": "the-bone:bone_bow"
}
}
--
package com.example.item.custom;
import java.util.List;
import java.util.function.Predicate;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.RangedWeaponItem;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.stat.Stats;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
public class Bone_Bow extends RangedWeaponItem {
public static final int TICKS_PER_SECOND = 20;
public static final int RANGE = 15;
public Bone_Bow(Item.Settings settings) {
super(settings);
}
@Override
public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) {
if (user instanceof PlayerEntity playerEntity) {
ItemStack itemStack = playerEntity.getProjectileType(stack);
if (!itemStack.isEmpty()) {
int i = this.getMaxUseTime(stack) - remainingUseTicks;
float f = getPullProgress(i);
if (!((double)f < 0.1)) {
List<ItemStack> list = load(stack, itemStack, playerEntity);
if (!world.isClient() && !list.isEmpty()) {
this.shootAll(world, playerEntity, playerEntity.getActiveHand(), stack, list, f * 9.0F, 0.0F, f == 1.0F, null);
}
world.playSound(
null,
playerEntity.getX(),
playerEntity.getY(),
playerEntity.getZ(),
SoundEvents.ENTITY_ARROW_SHOOT,
SoundCategory.PLAYERS,
1.0F,
1.0F / (world.getRandom().nextFloat() * 0.4F + 1.2F) + f * 0.5F
);
playerEntity.incrementStat(Stats.USED.getOrCreateStat(this));
}
}
}
}
@Override
protected void shoot(LivingEntity shooter, ProjectileEntity projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target) {
projectile.setVelocity(shooter, shooter.getPitch(), shooter.getYaw() + yaw, 0.0F, speed, divergence);
}
public static float getPullProgress(int useTicks) {
float f = (float)useTicks / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if (f > 1.0F) {
f = 1.0F;
}
return f;
}
@Override
public int getMaxUseTime(ItemStack stack) {
return 72000;
}
@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.BOW;
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
ItemStack itemStack = user.getStackInHand(hand);
boolean bl = !user.getProjectileType(itemStack).isEmpty();
if (!user.isInCreativeMode() && !bl) {
return TypedActionResult.fail(itemStack);
} else {
user.setCurrentHand(hand);
return TypedActionResult.consume(itemStack);
}
}
@Override
public Predicate<ItemStack> getProjectiles() {
return BOW_PROJECTILES;
}
@Override
public int getRange() {
return 15;
}
}
经测试,此版本目前未发现异常
报告人:J_pc(中国大陆,PRC)
报告时间:2025/2/2/13:09(东八区)
MOD创建时期:2025/2/2/11:39(东八区)
MOD版本:1.0.0_formal-1.20.5
MOD编写时的联网状态:个人网
MOD适用的Minecraft版本:《Minecraft JAVA 1.20.5-Fabric 0.16.10-Fabric API 0.97.8 Edition》
MOD适用的模组加载器版本:Fabric 0.16.10+ &Fabric API 0.97.8+
MOD当前版本完成时期:2025/2/2/13:07(东八区)
MOD当前版本测试完成时期:2025/2/2/13:07(东八区)
MOD编写时使用的操作系统:Windows10.0.19042.746
MOD编写时使用的中央处理器:Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz 2.40 GHz
MOD编写时使用的显卡:集成显卡
MOD编写时使用的JAVA解释器:JDK 21.0.3
MOD编写时使用的JAVA虚拟机:JAVA HOME-21.0.3
MOD测试时使用的启动器:Fabric Launcher
MOD测试时的联网状态:个人网
MOD测试时的登录方式:离线登录
MOD测试时使用的JAVA解释器:JDK 21.0.3
MOD测试时使用的Minecraft源:镜像源
MOD测试时的版本隔离:隔离所有版本
MOD测试时的JAVA虚拟机参数头:-XX:+UseG1GC -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -Dfml.ignoreInvalidMinecraftCertificates=True -Dfml.ignorePatchDiscrepancies=True -Dlog4j2.formatMsgNoLookups=true
JAVA虚拟机参数尾:
MOD测试时使用的Minecraft版本:《Minecraft JAVA 1.20.5-Fabric 0.16.10-Fabric API 0.97.8 Edition》