Buckets & entity enhancements, cleanup

This commit is contained in:
paulevsGitch 2021-04-19 21:22:11 +03:00
parent 00fd2b6199
commit 3ec2edd6d5
234 changed files with 1988 additions and 1643 deletions

View file

@ -1,6 +1,10 @@
package ru.betterend.item;
import java.util.UUID;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
@ -8,8 +12,6 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.Item;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import ru.betterend.mixin.common.ArmorItemAccessor;
import ru.betterend.patterns.Patterned;
import ru.betterend.patterns.Patterns;

View file

@ -0,0 +1,18 @@
package ru.betterend.item;
import net.minecraft.world.item.BucketItem;
import net.minecraft.world.level.material.Fluids;
import ru.betterend.patterns.Patterned;
import ru.betterend.patterns.Patterns;
import ru.betterend.registry.EndItems;
public class EndBucketItem extends BucketItem implements Patterned {
public EndBucketItem() {
super(Fluids.WATER, EndItems.makeItemSettings().stacksTo(1));
}
@Override
public String getModelPattern(String name) {
return Patterns.createJson(Patterns.ITEM_GENERATED, name);
}
}

View file

@ -1,43 +1,44 @@
package ru.betterend.item;
import java.util.List;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndItems;
import ru.betterend.util.LangUtil;
import vazkii.patchouli.api.PatchouliAPI;
public class GuideBookItem extends PatternedItem {
public final static ResourceLocation BOOK_ID = BetterEnd.makeID("guidebook");
public static final Item GUIDE_BOOK = EndItems.registerItem(BOOK_ID, new GuideBookItem());
public static void register() {}
public GuideBookItem() {
super(EndItems.makeItemSettings().stacksTo(1));
}
@Override
public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) {
if (!world.isClientSide && user instanceof ServerPlayer) {
PatchouliAPI.get().openBookGUI((ServerPlayer) user, BOOK_ID);
return InteractionResultHolder.success(user.getItemInHand(hand));
}
return InteractionResultHolder.consume(user.getItemInHand(hand));
}
@Override
public void appendHoverText(ItemStack stack, Level world, List<Component> tooltip, TooltipFlag context) {
tooltip.add(LangUtil.getText("book.betterend", "subtitle").withStyle(ChatFormatting.DARK_PURPLE, ChatFormatting.ITALIC));
}
}
package ru.betterend.item;
import java.util.List;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndItems;
import ru.betterend.util.LangUtil;
import vazkii.patchouli.api.PatchouliAPI;
public class GuideBookItem extends PatternedItem {
public final static ResourceLocation BOOK_ID = BetterEnd.makeID("guidebook");
public static final Item GUIDE_BOOK = EndItems.registerItem(BOOK_ID, new GuideBookItem());
public static void register() {}
public GuideBookItem() {
super(EndItems.makeItemSettings().stacksTo(1));
}
@Override
public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) {
if (!world.isClientSide && user instanceof ServerPlayer) {
PatchouliAPI.get().openBookGUI((ServerPlayer) user, BOOK_ID);
return InteractionResultHolder.success(user.getItemInHand(hand));
}
return InteractionResultHolder.consume(user.getItemInHand(hand));
}
@Override
public void appendHoverText(ItemStack stack, Level world, List<Component> tooltip, TooltipFlag context) {
tooltip.add(LangUtil.getText("book.betterend", "subtitle").withStyle(ChatFormatting.DARK_PURPLE, ChatFormatting.ITALIC));
}
}

View file

@ -1,6 +1,7 @@
package ru.betterend.item.material;
import java.util.function.Supplier;
import net.minecraft.util.LazyLoadedValue;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.crafting.Ingredient;

View file

@ -1,41 +1,43 @@
package ru.betterend.item.model;
import java.util.Collections;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
import com.google.common.collect.Lists;
public class CrystaliteBootsModel extends HumanoidModel<LivingEntity> {
public ModelPart leftBoot;
public ModelPart rightBoot;
public CrystaliteBootsModel(float scale) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.leftBoot = new ModelPart(this, 0, 32);
this.leftBoot.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.leftBoot.setPos(1.9F, 12.0F, 0.0F);
this.rightBoot = new ModelPart(this, 0, 16);
this.rightBoot.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.rightBoot.setPos(-1.9F, 12.0F, 0.0F);
}
@Override
public void copyPropertiesTo(HumanoidModel<LivingEntity> bipedEntityModel) {
super.copyPropertiesTo(bipedEntityModel);
this.leftBoot.copyFrom(leftLeg);
this.rightBoot.copyFrom(rightLeg);
}
@Override
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(leftBoot, rightBoot);
}
}
package ru.betterend.item.model;
import java.util.Collections;
import com.google.common.collect.Lists;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
public class CrystaliteBootsModel extends HumanoidModel<LivingEntity> {
public ModelPart leftBoot;
public ModelPart rightBoot;
public CrystaliteBootsModel(float scale) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.leftBoot = new ModelPart(this, 0, 32);
this.leftBoot.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.leftBoot.setPos(1.9F, 12.0F, 0.0F);
this.rightBoot = new ModelPart(this, 0, 16);
this.rightBoot.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.rightBoot.setPos(-1.9F, 12.0F, 0.0F);
}
@Override
public void copyPropertiesTo(HumanoidModel<LivingEntity> bipedEntityModel) {
super.copyPropertiesTo(bipedEntityModel);
this.leftBoot.copyFrom(leftLeg);
this.rightBoot.copyFrom(rightLeg);
}
@Override
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(leftBoot, rightBoot);
}
}

View file

@ -1,72 +1,74 @@
package ru.betterend.item.model;
import java.util.Collections;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.LivingEntity;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
public class CrystaliteChestplateModel extends HumanoidModel<LivingEntity> {
public ModelPart leftShoulder;
public ModelPart rightShoulder;
private boolean thinArms;
public CrystaliteChestplateModel(float scale, boolean thinArms) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.thinArms = thinArms;
this.body = new ModelPart(this, 16, 16);
this.body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale + 0.25F);
this.body.setPos(0.0F, 0.0F, 0.0F);
if (thinArms) {
this.leftShoulder = new ModelPart(this, 41, 32);
this.leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
this.leftShoulder.setPos(5.0F, 2.5F, 0.0F);
this.leftShoulder.mirror = true;
this.rightShoulder = new ModelPart(this, 41, 16);
this.rightShoulder.addBox(-2.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
this.rightShoulder.setPos(-5.0F, 2.5F, 10.0F);
} else {
this.leftShoulder = new ModelPart(this, 40, 32);
this.leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
this.leftShoulder.setPos(5.0F, 2.0F, 0.0F);
this.leftShoulder.mirror = true;
this.rightShoulder = new ModelPart(this, 40, 16);
this.rightShoulder.addBox(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
this.rightShoulder.setPos(-5.0F, 2.0F, 10.0F);
}
}
@Override
public void copyPropertiesTo(HumanoidModel<LivingEntity> bipedEntityModel) {
super.copyPropertiesTo(bipedEntityModel);
this.leftShoulder.copyFrom(leftArm);
this.rightShoulder.copyFrom(rightArm);
}
@Override
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(body, leftShoulder, rightShoulder);
}
@Override
public void translateToHand(HumanoidArm arm, PoseStack matrices) {
ModelPart modelPart = this.getArm(arm);
if (this.thinArms) {
float f = 0.5F * (float)(arm == HumanoidArm.RIGHT ? 1 : -1);
modelPart.x += f;
modelPart.translateAndRotate(matrices);
modelPart.x -= f;
} else {
modelPart.translateAndRotate(matrices);
}
}
}
package ru.betterend.item.model;
import java.util.Collections;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.LivingEntity;
public class CrystaliteChestplateModel extends HumanoidModel<LivingEntity> {
public ModelPart leftShoulder;
public ModelPart rightShoulder;
private boolean thinArms;
public CrystaliteChestplateModel(float scale, boolean thinArms) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.thinArms = thinArms;
this.body = new ModelPart(this, 16, 16);
this.body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale + 0.25F);
this.body.setPos(0.0F, 0.0F, 0.0F);
if (thinArms) {
this.leftShoulder = new ModelPart(this, 41, 32);
this.leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
this.leftShoulder.setPos(5.0F, 2.5F, 0.0F);
this.leftShoulder.mirror = true;
this.rightShoulder = new ModelPart(this, 41, 16);
this.rightShoulder.addBox(-2.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
this.rightShoulder.setPos(-5.0F, 2.5F, 10.0F);
} else {
this.leftShoulder = new ModelPart(this, 40, 32);
this.leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
this.leftShoulder.setPos(5.0F, 2.0F, 0.0F);
this.leftShoulder.mirror = true;
this.rightShoulder = new ModelPart(this, 40, 16);
this.rightShoulder.addBox(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
this.rightShoulder.setPos(-5.0F, 2.0F, 10.0F);
}
}
@Override
public void copyPropertiesTo(HumanoidModel<LivingEntity> bipedEntityModel) {
super.copyPropertiesTo(bipedEntityModel);
this.leftShoulder.copyFrom(leftArm);
this.rightShoulder.copyFrom(rightArm);
}
@Override
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(body, leftShoulder, rightShoulder);
}
@Override
public void translateToHand(HumanoidArm arm, PoseStack matrices) {
ModelPart modelPart = this.getArm(arm);
if (this.thinArms) {
float f = 0.5F * (float)(arm == HumanoidArm.RIGHT ? 1 : -1);
modelPart.x += f;
modelPart.translateAndRotate(matrices);
modelPart.x -= f;
} else {
modelPart.translateAndRotate(matrices);
}
}
}

View file

@ -1,34 +1,36 @@
package ru.betterend.item.model;
import java.util.Collections;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
import com.google.common.collect.Lists;
public class CrystaliteLeggingsModel extends HumanoidModel<LivingEntity> {
public CrystaliteLeggingsModel(float scale) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.body = new ModelPart(this, 16, 16);
this.body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale);
this.body.setPos(0.0F, 0.0F, 0.0F);
this.leftLeg = new ModelPart(this, 0, 32);
this.leftLeg.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.leftLeg.setPos(1.9F, 12.0F, 0.0F);
this.rightLeg = new ModelPart(this, 0, 16);
this.rightLeg.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.rightLeg.setPos(-1.9F, 12.0F, 0.0F);
}
@Override
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(body, rightLeg, leftLeg);
}
}
package ru.betterend.item.model;
import java.util.Collections;
import com.google.common.collect.Lists;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
public class CrystaliteLeggingsModel extends HumanoidModel<LivingEntity> {
public CrystaliteLeggingsModel(float scale) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.body = new ModelPart(this, 16, 16);
this.body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale);
this.body.setPos(0.0F, 0.0F, 0.0F);
this.leftLeg = new ModelPart(this, 0, 32);
this.leftLeg.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.leftLeg.setPos(1.9F, 12.0F, 0.0F);
this.rightLeg = new ModelPart(this, 0, 16);
this.rightLeg.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.rightLeg.setPos(-1.9F, 12.0F, 0.0F);
}
@Override
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(body, rightLeg, leftLeg);
}
}