diff --git a/common/src/main/java/net/hydra/jojomod/block/GasolineBlock.java b/common/src/main/java/net/hydra/jojomod/block/GasolineBlock.java index 6ca68de59..a0c65a796 100644 --- a/common/src/main/java/net/hydra/jojomod/block/GasolineBlock.java +++ b/common/src/main/java/net/hydra/jojomod/block/GasolineBlock.java @@ -134,22 +134,15 @@ public void tick(BlockState $$0, ServerLevel $$1, BlockPos $$2, RandomSource $$3 @SuppressWarnings("deprecation") @Override public void onProjectileHit(Level $$0, BlockState $$1, BlockHitResult $$2, Projectile $$3) { - if (!$$0.isClientSide) { - BlockPos $$4 = $$2.getBlockPos(); - if (($$3.isOnFire() || $$3 instanceof MatchEntity) && $$3.mayInteract($$0, $$4)) { - float power; - if ($$3 instanceof MatchEntity){ - if (((MatchEntity)$$3).isBundle){ - power = MainUtil.gasDamageMultiplier()*23; - } else { - power = MainUtil.gasDamageMultiplier()*18; - } - } else { - power = MainUtil.gasDamageMultiplier()*17; - } - MainUtil.gasExplode($$1, (ServerLevel) $$0, $$4, 0, 2, 4, power); - } + if ($$0.isClientSide) return; + BlockPos $$4 = $$2.getBlockPos(); + if (!(($$3.isOnFire() || $$3 instanceof MatchEntity) && $$3.mayInteract($$0, $$4))) return; + float factor = 17; + if ($$3 instanceof MatchEntity){ + if (((MatchEntity)$$3).isBundle) factor = 23; + else factor = 18; } + MainUtil.gasExplode($$1, (ServerLevel) $$0, $$4, 0, 2, 4, MainUtil.gasDamageMultiplier() * factor); } @SuppressWarnings("deprecation") @@ -170,25 +163,20 @@ protected void createBlockStateDefinition(StateDefinition.Builder $$1x.broadcastBreakEvent($$4)); - } else { - $$6.shrink(1); - } + if (!$$6.is(Items.FLINT_AND_STEEL) && !$$6.is(Items.FIRE_CHARGE)) return super.use($$0, $$1, $$2, $$3, $$4, $$5); + if (!$$1.isClientSide) MainUtil.gasExplode($$0, (ServerLevel) $$1, $$2, 0, 2, 4, MainUtil.gasDamageMultiplier()*14); + $$1.setBlock($$2, Blocks.AIR.defaultBlockState(), 11); + Item $$7 = $$6.getItem(); + if (!$$3.isCreative()) { + if ($$6.is(Items.FLINT_AND_STEEL)) { + $$6.hurtAndBreak(1, $$3, $$1x -> $$1x.broadcastBreakEvent($$4)); + } else { + $$6.shrink(1); } - - $$3.awardStat(Stats.ITEM_USED.get($$7)); - return InteractionResult.sidedSuccess($$1.isClientSide); } + + $$3.awardStat(Stats.ITEM_USED.get($$7)); + return InteractionResult.sidedSuccess($$1.isClientSide); } } diff --git a/common/src/main/java/net/hydra/jojomod/block/StereoBlock.java b/common/src/main/java/net/hydra/jojomod/block/StereoBlock.java index 13ddf5282..80a1343d5 100644 --- a/common/src/main/java/net/hydra/jojomod/block/StereoBlock.java +++ b/common/src/main/java/net/hydra/jojomod/block/StereoBlock.java @@ -51,11 +51,8 @@ public BlockState getStateForPlacement(BlockPlaceContext $$0) { @SuppressWarnings("deprecation") @Override public VoxelShape getShape(BlockState $$0, BlockGetter $$1, BlockPos $$2, CollisionContext $$3) { - if ($$0.getValue(FACING).getAxis() == Direction.Axis.X){ - return SHAPEA; - } else { - return SHAPEB; - } + if ($$0.getValue(FACING).getAxis() == Direction.Axis.X) return SHAPEA; + return SHAPEB; } @Override @@ -93,31 +90,22 @@ public InteractionResult use(BlockState $$0, Level $$1, BlockPos $$2, Player $$3 @Override public void onRemove(BlockState $$0, Level $$1, BlockPos $$2, BlockState $$3, boolean $$4) { - if (!$$0.is($$3.getBlock())) { - if ($$1.getBlockEntity($$2) instanceof StereoBlockEntity $$5) { - $$5.popOutRecord(); - } + if ($$0.is($$3.getBlock())) return; + if ($$1.getBlockEntity($$2) instanceof StereoBlockEntity $$5) $$5.popOutRecord(); - super.onRemove($$0, $$1, $$2, $$3, $$4); - } + super.onRemove($$0, $$1, $$2, $$3, $$4); } @Override public int getSignal(BlockState $$0, BlockGetter $$1, BlockPos $$2, Direction $$3) { - if ($$1.getBlockEntity($$2) instanceof StereoBlockEntity $$4 && $$4.isRecordPlaying()) { - return 20; - } - + if ($$1.getBlockEntity($$2) instanceof StereoBlockEntity $$4 && $$4.isRecordPlaying()) return 20; return 0; } @Override public int getAnalogOutputSignal(BlockState $$0, Level $$1, BlockPos $$2) { - if ($$1.getBlockEntity($$2) instanceof StereoBlockEntity $$3 && $$3.getFirstItem().getItem() instanceof RecordItem $$4) { - return $$4.getAnalogOutput(); - } - + if ($$1.getBlockEntity($$2) instanceof StereoBlockEntity $$3 && $$3.getFirstItem().getItem() instanceof RecordItem $$4) return $$4.getAnalogOutput(); return 0; } } diff --git a/common/src/main/java/net/hydra/jojomod/item/GlaiveItem.java b/common/src/main/java/net/hydra/jojomod/item/GlaiveItem.java index adacf9240..2cf306f1d 100644 --- a/common/src/main/java/net/hydra/jojomod/item/GlaiveItem.java +++ b/common/src/main/java/net/hydra/jojomod/item/GlaiveItem.java @@ -33,16 +33,14 @@ public class GlaiveItem extends SwordItem { public GlaiveItem(Tier $$0, float $$1, float $$2, Properties $$3, float chargeDamage) { super($$0, (int) $$1, $$2, $$3); - this.chargeDamage =chargeDamage; + this.chargeDamage = chargeDamage; } public GlaiveItem(Tier $$0, int $$1, float $$2, Properties $$3, float chargeDamage) { super($$0, $$1, $$2, $$3); - this.chargeDamage =chargeDamage; + this.chargeDamage = chargeDamage; } - - @Override public UseAnim getUseAnimation(ItemStack $$0) { return UseAnim.BOW; @@ -56,16 +54,11 @@ public int getUseDuration(ItemStack $$0) { @Override public InteractionResultHolder use(Level $$0, Player $$1, InteractionHand $$2) { ItemStack $$3 = $$1.getItemInHand($$2); - if ($$1.getAttackStrengthScale(1) >= 1F) { - $$1.startUsingItem($$2); - if ($$1.getUseItem() == $$3 && $$1.getUseItemRemainingTicks() == $$1.getUseItem().getUseDuration()) { - if ($$0.isClientSide) { - ModPacketHandler.PACKET_ACCESS.singleByteToServerPacket(PacketDataIndex.SINGLE_BYTE_GLAIVE_START_SOUND); - } - return InteractionResultHolder.success($$3); - } - } - return InteractionResultHolder.fail($$3); + if ($$1.getAttackStrengthScale(1) < 1F) return InteractionResultHolder.fail($$3); + $$1.startUsingItem($$2); + if ($$1.getUseItem() != $$3 || $$1.getUseItemRemainingTicks() != $$1.getUseItem().getUseDuration()) return InteractionResultHolder.fail($$3); + if ($$0.isClientSide) ModPacketHandler.PACKET_ACCESS.singleByteToServerPacket(PacketDataIndex.SINGLE_BYTE_GLAIVE_START_SOUND); + return InteractionResultHolder.success($$3); } @@ -94,38 +87,36 @@ public void releaseUsing(ItemStack $$0, Level $$1, LivingEntity $$2, int $$3) { } public void glaiveAttack(ItemStack $$0, Level $$1, ServerPlayer player, Entity target){ - if (player.getInventory().contains($$0)) { - $$1.playSound(null, player, ModSounds.GLAIVE_ATTACK_EVENT, SoundSource.PLAYERS, 1F, 1F); - if (target != null) { - float power = (float) player.getAttributeValue(Attributes.ATTACK_DAMAGE); - float $$2; - if (target instanceof LivingEntity) { - $$2 = EnchantmentHelper.getDamageBonus($$0, ((LivingEntity) target).getMobType()); - } else { - $$2 = EnchantmentHelper.getDamageBonus($$0, MobType.UNDEFINED); + if (!player.getInventory().contains($$0)) return; + $$1.playSound(null, player, ModSounds.GLAIVE_ATTACK_EVENT, SoundSource.PLAYERS, 1F, 1F); + if (target != null) { + float power = (float) player.getAttributeValue(Attributes.ATTACK_DAMAGE); + float $$2; + if (target instanceof LivingEntity) { + $$2 = EnchantmentHelper.getDamageBonus($$0, ((LivingEntity) target).getMobType()); + } else { + $$2 = EnchantmentHelper.getDamageBonus($$0, MobType.UNDEFINED); + } + power += $$2 + this.chargeDamage; + if (target.hurt(ModDamageTypes.of($$1, ModDamageTypes.GLAIVE, player), power)) { + if (!player.isCreative()) { + ItemStack item = player.getInventory().getItem((player.getInventory().findSlotMatchingItem($$0))); + item.hurt(1, $$1.getRandom(), player); } - power += $$2; - power += this.chargeDamage; - if (target.hurt(ModDamageTypes.of($$1, ModDamageTypes.GLAIVE, player), power)) { - if (!player.isCreative()) { - ItemStack item = player.getInventory().getItem((player.getInventory().findSlotMatchingItem($$0))); - item.hurt(1, $$1.getRandom(), player); - } - if (target instanceof LivingEntity) { - ((LivingEntity) target).knockback(0.35f, player.getX() - target.getX(), player.getZ() - target.getZ()); - if (MainUtil.getMobBleed(target)) { - if ($$0.getItem() instanceof GlaiveItem GI && GI.getTier() == Tiers.WOOD){ - MainUtil.makeBleed(target,0,400, player); - } else { - MainUtil.makeBleed(target,1,400, player); - MainUtil.makeMobBleed(target); - } + if (target instanceof LivingEntity) { + ((LivingEntity) target).knockback(0.35f, player.getX() - target.getX(), player.getZ() - target.getZ()); + if (MainUtil.getMobBleed(target)) { + if ($$0.getItem() instanceof GlaiveItem GI && GI.getTier() == Tiers.WOOD){ + MainUtil.makeBleed(target,0,400, player); + } else { + MainUtil.makeBleed(target,1,400, player); + MainUtil.makeMobBleed(target); } } - } else { - if (target instanceof LivingEntity) { - MainUtil.knockShield(target, 200); - } + } + } else { + if (target instanceof LivingEntity) { + MainUtil.knockShield(target, 200); } } } diff --git a/common/src/main/java/net/hydra/jojomod/item/KnifeItem.java b/common/src/main/java/net/hydra/jojomod/item/KnifeItem.java index 19e69eeae..6f7786467 100644 --- a/common/src/main/java/net/hydra/jojomod/item/KnifeItem.java +++ b/common/src/main/java/net/hydra/jojomod/item/KnifeItem.java @@ -56,7 +56,7 @@ public void releaseUsing(ItemStack $$0, Level $$1, LivingEntity $$2, int $$3) { if ($$2 instanceof Player $$4) { int $$5 = this.getUseDuration($$0) - $$3; int itemTime = 10; - if ($$0.is(ModItems.KNIFE)){itemTime=5;} + if ($$0.is(ModItems.KNIFE)) itemTime=5; if ($$5 >= itemTime) { if (!$$1.isClientSide) { $$0.hurtAndBreak(1, $$4, $$1x -> $$1x.broadcastBreakEvent($$2.getUsedItemHand())); @@ -104,10 +104,7 @@ public InteractionResultHolder use(Level $$0, Player $$1, Interaction @Override public int getEnchantmentValue() { - return - 1; + return 1; } - - } diff --git a/common/src/main/java/net/hydra/jojomod/item/MatchItem.java b/common/src/main/java/net/hydra/jojomod/item/MatchItem.java index 86446f7e9..7648c3f33 100644 --- a/common/src/main/java/net/hydra/jojomod/item/MatchItem.java +++ b/common/src/main/java/net/hydra/jojomod/item/MatchItem.java @@ -21,7 +21,8 @@ public class MatchItem extends Item implements Vanishable { - + //Default Duration: 72000 + public static final int MATCHITEM_DEFAULT_DURATION = 72000; public static final int THROW_THRESHOLD_TIME = 10; public static final float BASE_DAMAGE = 2.0F; public static final float SHOOT_POWER = 0.8F; @@ -35,7 +36,6 @@ public UseAnim getUseAnimation(ItemStack $$0) { return UseAnim.SPEAR; } - /**Default 72000*/ @Override public int getUseDuration(ItemStack $$0) { return 72000; @@ -87,10 +87,7 @@ public InteractionResultHolder use(Level $$0, Player $$1, Interaction @Override public int getEnchantmentValue() { - return - 1; + return 1; } - - } diff --git a/common/src/main/java/net/hydra/jojomod/item/MaxStandDiscItem.java b/common/src/main/java/net/hydra/jojomod/item/MaxStandDiscItem.java index c25d8a493..9c5bf2c18 100644 --- a/common/src/main/java/net/hydra/jojomod/item/MaxStandDiscItem.java +++ b/common/src/main/java/net/hydra/jojomod/item/MaxStandDiscItem.java @@ -29,11 +29,8 @@ public void appendHoverText(ItemStack $$0, @Nullable Level $$1, List $$2.add(this.getDisplayName2().withStyle(ChatFormatting.AQUA)); $$2.add(Component.translatable("leveling.roundabout.disc_maxed").withStyle(ChatFormatting.GRAY)); CompoundTag $$4 = $$0.getTagElement("Memory"); - if ($$4 != null && $$1 != null) { - if ($$4.contains("Skin")) { - byte skin = ($$4.getByte("Skin")); - $$2.add(Component.literal(standPowers.getSkinName(skin).getString()).withStyle(ChatFormatting.BLUE)); - } - } + if ($$4 == null || $$1 == null || !$$4.contains("Skin")) return; + byte skin = ($$4.getByte("Skin")); + $$2.add(Component.literal(standPowers.getSkinName(skin).getString()).withStyle(ChatFormatting.BLUE)); } } diff --git a/common/src/main/java/net/hydra/jojomod/item/ScissorItem.java b/common/src/main/java/net/hydra/jojomod/item/ScissorItem.java index 9b677b9ea..fb9205e66 100644 --- a/common/src/main/java/net/hydra/jojomod/item/ScissorItem.java +++ b/common/src/main/java/net/hydra/jojomod/item/ScissorItem.java @@ -86,17 +86,17 @@ public boolean mineBlock(ItemStack $$0, Level $$1, BlockState $$2, BlockPos $$3, $$0.hurtAndBreak(1, $$4, $$0x -> $$0x.broadcastBreakEvent(EquipmentSlot.MAINHAND)); } - return !$$2.is(BlockTags.LEAVES) - && !$$2.is(Blocks.COBWEB) - && !$$2.is(Blocks.GRASS) - && !$$2.is(Blocks.FERN) - && !$$2.is(Blocks.DEAD_BUSH) - && !$$2.is(Blocks.HANGING_ROOTS) - && !$$2.is(Blocks.VINE) - && !$$2.is(Blocks.TRIPWIRE) - && !$$2.is(BlockTags.WOOL) - ? super.mineBlock($$0, $$1, $$2, $$3, $$4) - : true; + return $$2.is(BlockTags.LEAVES) + || $$2.is(Blocks.COBWEB) + || $$2.is(Blocks.GRASS) + || $$2.is(Blocks.FERN) + || $$2.is(Blocks.DEAD_BUSH) + || $$2.is(Blocks.HANGING_ROOTS) + || $$2.is(Blocks.VINE) + || $$2.is(Blocks.TRIPWIRE) + || $$2.is(BlockTags.WOOL) + ? true + : super.mineBlock($$0, $$1, $$2, $$3, $$4); } @Override @@ -106,15 +106,10 @@ public boolean isCorrectToolForDrops(BlockState $$0) { @Override public float getDestroySpeed(ItemStack $$0, BlockState $$1) { - if ($$1.is(BlockTags.LEAVES)) { - return 3.0F; - } else if ($$1.is(Blocks.COBWEB)) { - return 12.0F; - } else if ($$1.is(BlockTags.WOOL)) { - return 4.0F; - } else { - return !$$1.is(Blocks.VINE) && !$$1.is(Blocks.GLOW_LICHEN) ? super.getDestroySpeed($$0, $$1) : 2.0F; - } + if ($$1.is(BlockTags.LEAVES)) return 3.0F; + if ($$1.is(Blocks.COBWEB)) return 12.0F; + if ($$1.is(BlockTags.WOOL)) return 4.0F; + return $$1.is(Blocks.VINE) || $$1.is(Blocks.GLOW_LICHEN) ? 2.0F : super.getDestroySpeed($$0, $$1); } @Override