mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Merge branch 'mc1.20.1/feature-dev' into mc1.21.1/dev
# Conflicts: # build.gradle # gradle.properties
This commit is contained in:
commit
e4b1f80ff3
3 changed files with 27 additions and 42 deletions
|
@ -34,7 +34,6 @@ jei_version = 19.5.0.33
|
|||
curios_minecraft_version = 1.21.1
|
||||
curios_version = 9.2.2
|
||||
ponder_version = 0.9.14
|
||||
catnip_and_ponder_mc_ver = 1.21.1
|
||||
|
||||
cc_tweaked_enable = true
|
||||
cc_tweaked_minecraft_version = 1.21.1
|
||||
|
|
|
@ -74,6 +74,8 @@ import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
|
|||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.food.FoodProperties;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ArmorMaterials;
|
||||
|
@ -155,7 +157,16 @@ public class AllItems {
|
|||
|
||||
public static final ItemEntry<BuildersTeaItem> BUILDERS_TEA = REGISTRATE.item("builders_tea", BuildersTeaItem::new)
|
||||
.tag(AllItemTags.UPRIGHT_ON_BELT.tag)
|
||||
.properties(p -> p.stacksTo(16))
|
||||
.properties(p -> p
|
||||
.stacksTo(16)
|
||||
.food(new FoodProperties.Builder()
|
||||
.nutrition(1)
|
||||
.saturationMod(.6F)
|
||||
.alwaysEat()
|
||||
.effect(() -> new MobEffectInstance(MobEffects.DIG_SPEED, 3 * 60 * 20, 0, false, false, false), 1F)
|
||||
.build()
|
||||
)
|
||||
)
|
||||
.lang("Builder's Tea")
|
||||
.register();
|
||||
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
package com.simibubi.create.content.equipment;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -15,48 +8,30 @@ import net.minecraft.world.item.Items;
|
|||
import net.minecraft.world.item.UseAnim;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BuildersTeaItem extends Item {
|
||||
|
||||
public BuildersTeaItem(Properties p_i48487_1_) {
|
||||
super(p_i48487_1_);
|
||||
public BuildersTeaItem(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity entity) {
|
||||
Player playerentity = entity instanceof Player ? (Player) entity : null;
|
||||
if (playerentity instanceof ServerPlayer)
|
||||
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) playerentity, stack);
|
||||
|
||||
if (!world.isClientSide)
|
||||
entity.addEffect(new MobEffectInstance(MobEffects.DIG_SPEED, 3 * 60 * 20, 0, false, false, false));
|
||||
|
||||
if (playerentity != null) {
|
||||
playerentity.awardStat(Stats.ITEM_USED.get(this));
|
||||
playerentity.getFoodData().eat(1, .6F);
|
||||
if (!playerentity.getAbilities().instabuild)
|
||||
stack.shrink(1);
|
||||
public @NotNull ItemStack finishUsingItem(@NotNull ItemStack stack, @NotNull Level level, @NotNull LivingEntity livingEntity) {
|
||||
ItemStack eatResult = super.finishUsingItem(stack, level, livingEntity);
|
||||
if (livingEntity instanceof Player player && !player.getAbilities().instabuild) {
|
||||
if (eatResult.isEmpty()) {
|
||||
return Items.GLASS_BOTTLE.getDefaultInstance();
|
||||
} else {
|
||||
player.getInventory().add(Items.GLASS_BOTTLE.getDefaultInstance());
|
||||
}
|
||||
}
|
||||
return eatResult;
|
||||
}
|
||||
|
||||
if (playerentity == null || !playerentity.getAbilities().instabuild) {
|
||||
if (stack.isEmpty())
|
||||
return new ItemStack(Items.GLASS_BOTTLE);
|
||||
if (playerentity != null)
|
||||
playerentity.getInventory().add(new ItemStack(Items.GLASS_BOTTLE));
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getUseDuration(ItemStack p_77626_1_) {
|
||||
public int getUseDuration(@NotNull ItemStack stack) {
|
||||
return 42;
|
||||
}
|
||||
|
||||
public UseAnim getUseAnimation(ItemStack p_77661_1_) {
|
||||
public @NotNull UseAnim getUseAnimation(@NotNull ItemStack stack) {
|
||||
return UseAnim.DRINK;
|
||||
}
|
||||
|
||||
public InteractionResultHolder<ItemStack> use(Level p_77659_1_, Player p_77659_2_, InteractionHand p_77659_3_) {
|
||||
p_77659_2_.startUsingItem(p_77659_3_);
|
||||
return InteractionResultHolder.success(p_77659_2_.getItemInHand(p_77659_3_));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue