Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.mcreator.whitevuwsmodformachinima.entity;
- import net.minecraftforge.fml.relauncher.SideOnly;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
- import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
- import net.minecraftforge.fml.client.registry.RenderingRegistry;
- import net.minecraft.world.biome.Biome;
- import net.minecraft.world.World;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.DamageSource;
- import net.minecraft.item.Item;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.EnumCreatureAttribute;
- import net.minecraft.entity.EntityCreature;
- import net.minecraft.entity.Entity;
- import net.minecraft.client.renderer.entity.RenderLiving;
- import net.mcreator.whitevuwsmodformachinima.ElementsWhiteVuwsmodformachinima;
- import java.util.Iterator;
- import java.util.ArrayList;
- @ElementsWhiteVuwsmodformachinima.ModElement.Tag
- public class EntityHand extends ElementsWhiteVuwsmodformachinima.ModElement {
- public static final int ENTITYID = 1;
- public static final int ENTITYID_RANGED = 2;
- public EntityHand(ElementsWhiteVuwsmodformachinima instance) {
- super(instance, 2);
- }
- @Override
- public void initElements() {
- elements.entities.add(() -> EntityEntryBuilder.create().entity(EntityCustom.class)
- .id(new ResourceLocation("whitevuwsmodformachinima", "hand"), ENTITYID).name("hand").tracker(64, 3, true).egg(-1, -1).build());
- }
- private Biome[] allbiomes(net.minecraft.util.registry.RegistryNamespaced<ResourceLocation, Biome> in) {
- Iterator<Biome> itr = in.iterator();
- ArrayList<Biome> ls = new ArrayList<Biome>();
- while (itr.hasNext())
- ls.add(itr.next());
- return ls.toArray(new Biome[ls.size()]);
- }
- @SideOnly(Side.CLIENT)
- @Override
- public void preInit(FMLPreInitializationEvent event) {
- RenderingRegistry.registerEntityRenderingHandler(EntityCustom.class, renderManager -> {
- return new RenderLiving(renderManager, new Modelhand(), 0.5f) {
- protected ResourceLocation getEntityTexture(Entity entity) {
- return new ResourceLocation("whitevuwsmodformachinima:textures/texture.png");
- }
- };
- });
- }
- public static class EntityCustom extends EntityCreature {
- public EntityCustom(World world) {
- super(world);
- setSize(0.6f, 1.8f);
- experienceValue = 5;
- this.isImmuneToFire = false;
- setNoAI(!false);
- enablePersistence();
- }
- @Override
- public EnumCreatureAttribute getCreatureAttribute() {
- return EnumCreatureAttribute.UNDEFINED;
- }
- @Override
- protected boolean canDespawn() {
- return false;
- }
- @Override
- protected Item getDropItem() {
- return null;
- }
- @Override
- public net.minecraft.util.SoundEvent getAmbientSound() {
- return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(""));
- }
- @Override
- public net.minecraft.util.SoundEvent getHurtSound(DamageSource ds) {
- return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("entity.generic.hurt"));
- }
- @Override
- public net.minecraft.util.SoundEvent getDeathSound() {
- return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("entity.generic.death"));
- }
- @Override
- protected float getSoundVolume() {
- return 1.0F;
- }
- @Override
- protected void applyEntityAttributes() {
- super.applyEntityAttributes();
- if (this.getEntityAttribute(SharedMonsterAttributes.ARMOR) != null)
- this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(0D);
- if (this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED) != null)
- this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.3D);
- if (this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH) != null)
- this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10D);
- if (this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE) != null)
- this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3D);
- }
- }
- public static class Modelhand extends Entity extends EntityModel<T> {
- public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("modid", "hand_model"), "main");
- private final ModelPart bone;
- private final ModelPart bone2;
- private final ModelPart bone3;
- private final ModelPart bone4;
- private final ModelPart bb_main;
- public Modelhand(ModelPart root) {
- this.bone = root.getChild("bone");
- this.bone2 = root.getChild("bone2");
- this.bone3 = root.getChild("bone3");
- this.bone4 = root.getChild("bone4");
- this.bb_main = root.getChild("bb_main");
- }
- public static LayerDefinition createBodyLayer() {
- MeshDefinition meshdefinition = new MeshDefinition();
- PartDefinition partdefinition = meshdefinition.getRoot();
- PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(16, 18).addBox(-0.75F, -14.0F, -4.0F, 1.5F, 5.0F, 2.0F, new CubeDeformation(0.0F))
- .texOffs(0, 25).addBox(-0.5F, -18.0F, -3.75F, 1.0F, 4.0F, 1.5F, new CubeDeformation(0.0F))
- .texOffs(14, 25).addBox(-0.35F, -21.0F, -3.5F, 0.75F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
- PartDefinition bone2 = partdefinition.addOrReplaceChild("bone2", CubeListBuilder.create().texOffs(8, 18).addBox(-0.75F, -14.0F, -1.75F, 1.5F, 5.0F, 2.0F, new CubeDeformation(0.0F))
- .texOffs(24, 17).addBox(-0.5F, -18.0F, -1.5F, 1.0F, 4.0F, 1.5F, new CubeDeformation(0.0F))
- .texOffs(10, 25).addBox(-0.35F, -21.0F, -1.25F, 0.75F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
- PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(0, 18).addBox(-0.75F, -14.0F, 0.5F, 1.5F, 5.0F, 2.0F, new CubeDeformation(0.0F))
- .texOffs(22, 23).addBox(-0.5F, -18.0F, 0.75F, 1.0F, 4.0F, 1.5F, new CubeDeformation(0.0F))
- .texOffs(6, 25).addBox(-0.35F, -21.0F, 1.0F, 0.75F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
- PartDefinition bone4 = partdefinition.addOrReplaceChild("bone4", CubeListBuilder.create().texOffs(0, 0).addBox(-0.75F, -14.0F, 3.0F, 1.5F, 5.0F, 2.0F, new CubeDeformation(0.0F))
- .texOffs(22, 11).addBox(-0.5F, -18.0F, 3.25F, 1.0F, 4.0F, 1.5F, new CubeDeformation(0.0F))
- .texOffs(23, 0).addBox(-0.35F, -21.0F, 3.5F, 0.75F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
- PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, -9.0F, -4.0F, 2.0F, 9.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
- PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(22, 5).addBox(-1.0F, -2.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -6.5442F, -6.6651F, 0.5236F, 0.0F, 0.0F));
- PartDefinition cube_r2 = bb_main.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(13, 0).addBox(-1.0F, -2.0F, -1.5F, 2.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0801F, -4.6651F, 0.5236F, 0.0F, 0.0F));
- return LayerDefinition.create(meshdefinition, 32, 32);
- }
- @Override
- public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
- }
- @Override
- public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
- bone.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
- bone2.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
- bone3.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
- bone4.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
- bb_main.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement