From 52750fdffae20e60647f0706f4b53945726d537f Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Thu, 17 Jun 2021 21:21:05 +0300 Subject: [PATCH] Disc rename, drink fix --- gradle.properties | 2 +- .../items/{EndDiscItem.java => BaseDiscItem.java} | 4 ++-- src/main/java/ru/bclib/items/BaseDrinkItem.java | 10 ++++++++-- src/main/java/ru/bclib/registry/ItemsRegistry.java | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) rename src/main/java/ru/bclib/items/{EndDiscItem.java => BaseDiscItem.java} (56%) diff --git a/gradle.properties b/gradle.properties index 99bfcf99..6a044b22 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ yarn_mappings=6 loader_version=0.11.3 # Mod Properties -mod_version = 0.1.34 +mod_version = 0.1.35 maven_group = ru.bclib archives_base_name = bclib diff --git a/src/main/java/ru/bclib/items/EndDiscItem.java b/src/main/java/ru/bclib/items/BaseDiscItem.java similarity index 56% rename from src/main/java/ru/bclib/items/EndDiscItem.java rename to src/main/java/ru/bclib/items/BaseDiscItem.java index dcae4586..3b6a8e46 100644 --- a/src/main/java/ru/bclib/items/EndDiscItem.java +++ b/src/main/java/ru/bclib/items/BaseDiscItem.java @@ -4,8 +4,8 @@ import net.minecraft.world.item.RecordItem; import ru.bclib.client.models.ItemModelProvider; -public class EndDiscItem extends RecordItem implements ItemModelProvider { - public EndDiscItem(int comparatorOutput, SoundEvent sound, Properties settings) { +public class BaseDiscItem extends RecordItem implements ItemModelProvider { + public BaseDiscItem(int comparatorOutput, SoundEvent sound, Properties settings) { super(comparatorOutput, sound, settings); } } diff --git a/src/main/java/ru/bclib/items/BaseDrinkItem.java b/src/main/java/ru/bclib/items/BaseDrinkItem.java index 66122ec0..cf4b520d 100644 --- a/src/main/java/ru/bclib/items/BaseDrinkItem.java +++ b/src/main/java/ru/bclib/items/BaseDrinkItem.java @@ -34,7 +34,13 @@ public InteractionResultHolder use(Level world, Player user, Interact } @Override - public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) { + public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity user) { + if (this.isEdible()) { + int count = stack.getCount(); + user.eat(level, stack); + stack.setCount(count); + } + if (user instanceof ServerPlayer) { ServerPlayer serverPlayerEntity = (ServerPlayer) user; CriteriaTriggers.CONSUME_ITEM.trigger(serverPlayerEntity, stack); @@ -45,7 +51,7 @@ public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user stack.shrink(1); } - if (!world.isClientSide) { + if (!level.isClientSide) { user.removeAllEffects(); } diff --git a/src/main/java/ru/bclib/registry/ItemsRegistry.java b/src/main/java/ru/bclib/registry/ItemsRegistry.java index 724fac42..8d2c6def 100644 --- a/src/main/java/ru/bclib/registry/ItemsRegistry.java +++ b/src/main/java/ru/bclib/registry/ItemsRegistry.java @@ -21,7 +21,7 @@ import net.minecraft.world.level.block.DispenserBlock; import ru.bclib.items.BaseDrinkItem; import ru.bclib.items.BaseSpawnEggItem; -import ru.bclib.items.EndDiscItem; +import ru.bclib.items.BaseDiscItem; import ru.bclib.items.ModelProviderItem; import ru.bclib.items.tool.BaseAxeItem; import ru.bclib.items.tool.BaseHoeItem; @@ -35,7 +35,7 @@ protected ItemsRegistry(CreativeModeTab creativeTab) { } public Item registerDisc(String name, int power, SoundEvent sound) { - return register(name, new EndDiscItem(power, sound, makeItemSettings().stacksTo(1))); + return register(name, new BaseDiscItem(power, sound, makeItemSettings().stacksTo(1))); } public Item registerItem(String name) {