-
Posts
292 -
Joined
-
Last visited
Everything posted by _Cruelar_
-
i dont know what to name this
_Cruelar_ replied to wappy_dantdm_fan's topic in Support & Bug Reports
Yes today it wanted to install malware on my PC without me even clicking on anything -
[Solved][1.12.2]How to get a model for a block
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
I just redownloaded the Mdk (with getting malware from the adfly page without even clicking on anything; thanks to my security programm nothing happened) and still he can't find the textures although being in the right place. -
Try to reinstall Minecraft. Where he got his Forge? Because normal Forge shouldn't cause this.
-
[1.12.2] How to get multiple Hitboxes for one Entity
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
Could anyone explain to me if this is always the case when using IEntityMultiPart. -
Check if MainHand is null to use autoclick right
_Cruelar_ replied to NqwSqw's topic in Modder Support
Have you even looked at the info in the link? Both Vanilla and Forge code expect ItemStacks to be not null so they use Itemstack.EMPTY use ItemStack.isEmpty() to check for that. -
Updated code. When I start minecraft the debugger says me he can't evaluate it classname.toString() So what should I do to fix that without giving up on the Entity?
-
Check if MainHand is null to use autoclick right
_Cruelar_ replied to NqwSqw's topic in Modder Support
Try checking getHeldItem(MainHand).isEmpty() Also Is always true. Look at Problematic code 12# -
This might need some time as I only have an idea which I totally not know how to code. The Entity should have a Mainbody with one eye in the Head shooting lasers which deal 6 damage fully ignoring the Players armor. Additionally the Entity should have 6 legs with their own health which the Player can cut off by damaging them enough. My Idea for this is making the legs separate entities (is this actually possible?), but I'll accept all other working approaches. Also if the Entity is shot into its eye with any Arrow or a leg is cut off he'll get stunned for ~5sec. When the Entity detects the Player he'll start aiming at him with a thin red laser dealing no damage and after ~5 sec will then shoot a powerful blue laser at the Player. I have already a Model for the Mainbody and a model for the legs is almost done. What I mostly need help with is how to make that with the legs being part of the MainEntity and being able to be cut off, the Ai for this Entity and the actual laser beams. I know this much what I request here but working on that alone I woud get completly lost in Code and make tons of mistakes. I'll post new Code as soon as I can and hope that we all can get it working. Until then every help how to make this is appreciated My Code. MainBodyModel: package com.cruelar.cruelars_triforcemod.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; /** * ModelGuardianStalkerBody - Cruelar * Created using Tabula 7.0.0 */ public class ModelGuardianStalkerBody extends ModelBase { public ModelRenderer MainBody; public ModelRenderer UpperBodyOne; public ModelRenderer LowerGear; public ModelRenderer UpperGear; public ModelRenderer UpperBodyTwo; public ModelRenderer Head; public ModelRenderer GuardianEye; public ModelRenderer HeadPieceLeft; public ModelRenderer HeadPieceRight; public ModelRenderer HeadPieceBack; public ModelGuardianStalkerBody() { this.textureWidth = 256; this.textureHeight = 128; this.UpperGear = new ModelRenderer(this, 186, 32); this.UpperGear.setRotationPoint(0.0F, -3.0F, 0.0F); this.UpperGear.addBox(-7.0F, -1.0F, -7.0F, 14, 2, 14, 0.0F); this.HeadPieceRight = new ModelRenderer(this, 22, 0); this.HeadPieceRight.mirror = true; this.HeadPieceRight.setRotationPoint(0.0F, -13.0F, 0.0F); this.HeadPieceRight.addBox(-12.0F, -10.0F, -1.0F, 6, 6, 2, 0.0F); this.MainBody = new ModelRenderer(this, 0, 0); this.MainBody.setRotationPoint(0.0F, 16.0F, 0.0F); this.MainBody.addBox(-24.0F, -5.0F, -24.0F, 48, 13, 48, 0.0F); this.HeadPieceBack = new ModelRenderer(this, 144, 0); this.HeadPieceBack.setRotationPoint(0.0F, -13.0F, 0.0F); this.HeadPieceBack.addBox(-1.0F, -10.0F, 6.0F, 2, 6, 6, 0.0F); this.Head = new ModelRenderer(this, 176, 48); this.Head.setRotationPoint(0.0F, -12.0F, 0.0F); this.Head.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16, 0.0F); this.UpperBodyTwo = new ModelRenderer(this, 0, 61); this.UpperBodyTwo.setRotationPoint(0.0F, 10.0F, 0.0F); this.UpperBodyTwo.addBox(-17.0F, -4.0F, -17.0F, 34, 6, 34, 0.0F); this.HeadPieceLeft = new ModelRenderer(this, 22, 0); this.HeadPieceLeft.setRotationPoint(0.0F, -13.0F, 0.0F); this.HeadPieceLeft.addBox(6.0F, -10.0F, -1.0F, 6, 6, 2, 0.0F); this.GuardianEye = new ModelRenderer(this, 0, 0); this.GuardianEye.setRotationPoint(0.0F, -9.0F, 0.0F); this.GuardianEye.addBox(-2.0F, -2.0F, -9.0F, 4, 4, 1, 0.0F); this.UpperBodyOne = new ModelRenderer(this, 144, 0); this.UpperBodyOne.setRotationPoint(0.0F, 4.0F, 0.0F); this.UpperBodyOne.addBox(-12.0F, -4.0F, -12.0F, 24, 6, 24, 0.0F); this.LowerGear = new ModelRenderer(this, 144, 30); this.LowerGear.setRotationPoint(0.0F, -1.0F, 0.0F); this.LowerGear.addBox(-7.0F, -1.0F, -7.0F, 14, 2, 14, 0.0F); } @Override @SideOnly(Side.CLIENT) public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.UpperGear.render(f5); this.HeadPieceRight.render(f5); this.MainBody.render(f5); this.HeadPieceBack.render(f5); this.Head.render(f5); this.UpperBodyTwo.render(f5); this.HeadPieceLeft.render(f5); this.GuardianEye.render(f5); this.UpperBodyOne.render(f5); this.LowerGear.render(f5); } /** * This is a helper function from Tabula to set the rotation of model parts */ public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } MainEntity: package com.cruelar.cruelars_triforcemod.entities.monster; import net.minecraft.entity.*; import net.minecraft.entity.ai.*; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.PacketBuffer; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializer; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.IOException; import java.util.UUID; public class Guardian_Stalker extends EntityMob implements IRangedAttackMob/*,IEntityMultiPart*/{ public static final ResourceLocation RESOURCE_LOCATION = new ResourceLocation("cruelars_triforcemod:textures/entity/guardian_stalker.png"); /*private static final DataSerializer<UUID> serializer = new DataSerializer<UUID>() { @Override public void write(@Nonnull PacketBuffer buf,@Nonnull UUID value) { buf.writeUniqueId(value); } @Override @Nonnull public UUID read(@Nonnull PacketBuffer buf) throws IOException { return buf.readUniqueId(); } @Override public DataParameter<UUID> createKey(int id) { return new DataParameter<>(id,this); } @Override @Nonnull public UUID copyValue(@Nonnull UUID value) { return value; } }; private static final DataParameter<UUID> Leg1 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg2 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg3 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg4 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg5 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer); private static final DataParameter<UUID> Leg6 = EntityDataManager.<UUID>createKey(Guardian_Stalker.class, serializer);*/ private LegGuardian leg1; private LegGuardian leg2; private LegGuardian leg3; private LegGuardian leg4; private LegGuardian leg5; private LegGuardian leg6; private LegGuardian[] legs; //private MultiPartEntityPart guardianEye = new MultiPartEntityPart(this,"eye",0.25F,0.25F); //private MultiPartEntityPart[] guardianParts; private float animTime; private float prevAnimTime; public Guardian_Stalker(World worldIn) { super(worldIn); setSize(2.8F,2F ); this.legs=new LegGuardian[]{leg1,leg2,leg3,leg4,leg5,leg6}; //this.guardianParts= new MultiPartEntityPart[]{this.guardianEye}; } @Override protected void entityInit(){ super.entityInit(); /*this.getDataManager().register(Leg1, leg1.getUniqueID()); this.getDataManager().register(Leg2, leg2.getUniqueID()); this.getDataManager().register(Leg3, leg3.getUniqueID()); this.getDataManager().register(Leg4, leg4.getUniqueID()); this.getDataManager().register(Leg5, leg5.getUniqueID()); this.getDataManager().register(Leg6, leg6.getUniqueID()); } public void setLeg1(LegGuardian legGuardian) { this.getDataManager().set(Leg1, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg1() { return this.getDataManager().get(Leg1); } public void setLeg2(LegGuardian legGuardian) { this.getDataManager().set(Leg2, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg2() { return this.getDataManager().get(Leg2); } public void setLeg3(LegGuardian legGuardian) { this.getDataManager().set(Leg3, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg3() { return this.getDataManager().get(Leg3); } public void setLeg4(LegGuardian legGuardian) { this.getDataManager().set(Leg4, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg4() { return this.getDataManager().get(Leg4); } public void setLeg5(LegGuardian legGuardian) { this.getDataManager().set(Leg5, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg5() { return this.getDataManager().get(Leg5); } public void setLeg6(LegGuardian legGuardian) { this.getDataManager().set(Leg6, legGuardian.getUniqueID()); } @SideOnly(Side.CLIENT) public UUID getLeg6() { return this.getDataManager().get(Leg6);*/ } @Override protected void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(1500.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D); this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(10.0D); this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(32.0D); this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(6.0D); } @Override protected void initEntityAI(){ this.tasks.addTask(5,new EntityAIMoveTowardsRestriction(this,1.0D)); this.tasks.addTask(7,new EntityAIWander(this,1.0D)); this.tasks.addTask(8,new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8,new EntityAILookIdle(this)); this.applyEntityAI(); } public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty,@Nullable IEntityLivingData livingdata){ livingdata = super.onInitialSpawn(difficulty, livingdata); leg1 = new LegGuardian(this.world); leg2 = new LegGuardian(this.world); leg3 = new LegGuardian(this.world); leg4 = new LegGuardian(this.world); leg5 = new LegGuardian(this.world); leg6 = new LegGuardian(this.world); leg1.setParent(this); leg2.setParent(this); leg3.setParent(this); leg4.setParent(this); leg5.setParent(this); leg6.setParent(this); leg1.setPartName("leg1"); leg2.setPartName("leg2"); leg3.setPartName("leg3"); leg4.setPartName("leg4"); leg5.setPartName("leg5"); leg6.setPartName("leg6"); legs= new LegGuardian[]{leg1,leg2,leg3,leg4,leg5,leg6}; for (int i = 0;i<legs.length;i++){ legs[i].setPositionAndRotation(this.posX, this.posY, this.posZ, i*MathHelper.wrapDegrees(60)+this.rotationYaw, 0); } this.world.spawnEntity(leg1); this.world.spawnEntity(leg2); this.world.spawnEntity(leg3); this.world.spawnEntity(leg4); this.world.spawnEntity(leg5); this.world.spawnEntity(leg6); return livingdata; } protected void onDeathUpdate() { ++this.deathTime; if (this.deathTime == 20) { for (LegGuardian leg : legs) { if (leg != null) { leg.setDead(); } } this.setDead(); for (int k = 0; k < 20; ++k) { double d2 = this.rand.nextGaussian() * 0.02D; double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, d2, d0, d1); } } } protected void applyEntityAI() { this.targetTasks.addTask(1,new EntityAIAttackRanged(this,0.25D,100,120,5)); } @Override public void attackEntityWithRangedAttack(@Nonnull EntityLivingBase target, float distanceFactor) { } public void onLivingUpdate() { if (this.world.isRemote) { this.setHealth(this.getHealth()); } this.prevAnimTime = this.animTime; if (this.getHealth() <= 0.0F) { float f12 = (this.rand.nextFloat() - 0.5F) * 8.0F; float f13 = (this.rand.nextFloat() - 0.5F) * 4.0F; float f15 = (this.rand.nextFloat() - 0.5F) * 8.0F; this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX + (double)f12, this.posY + 2.0D + (double)f13, this.posZ + (double)f15, 0.0D, 0.0D, 0.0D); } else { float f11 = 0.2F / (MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F); f11 = f11 * (float)Math.pow(2.0D, this.motionY); this.animTime += f11; this.rotationYaw = MathHelper.wrapDegrees(this.rotationYaw); if (this.isAIDisabled()) { this.animTime = 0.5F; } else { if (this.world.isRemote) { if (this.newPosRotationIncrements > 0) { double d5 = this.posX + (this.interpTargetX - this.posX) / (double)this.newPosRotationIncrements; double d0 = this.posY + (this.interpTargetY - this.posY) / (double)this.newPosRotationIncrements; double d1 = this.posZ + (this.interpTargetZ - this.posZ) / (double)this.newPosRotationIncrements; double d2 = MathHelper.wrapDegrees(this.interpTargetYaw - (double)this.rotationYaw); this.rotationYaw = (float)((double)this.rotationYaw + d2 / (double)this.newPosRotationIncrements); this.rotationPitch = (float)((double)this.rotationPitch + (this.interpTargetPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements); --this.newPosRotationIncrements; this.setPosition(d5, d0, d1); this.setRotation(this.rotationYaw, this.rotationPitch); } } this.renderYawOffset = this.rotationYaw; float Yaw = this.rotationYaw; //this.guardianEye.width=0.25F; //this.guardianEye.height=0.25F; /*Vec3d[] avec3d = new Vec3d[this.guardianParts.length]; for (int j = 0; j < this.guardianParts.length; ++j) { avec3d[j] = new Vec3d(this.guardianParts[j].posX, this.guardianParts[j].posY, this.guardianParts[j].posZ); } float f17 = this.rotationYaw * 0.017453292F; float f3 = MathHelper.sin(f17); float f18 = MathHelper.cos(f17); this.guardianEye.onUpdate(); this.guardianEye.setLocationAndAngles(this.posX+0.5, this.posY+2, this.posZ, 0.0F, 0.0F); for (int l = 0; l < this.guardianParts.length; ++l) { this.guardianParts[l].prevPosX = avec3d[l].x; this.guardianParts[l].prevPosY = avec3d[l].y; this.guardianParts[l].prevPosZ = avec3d[l].z; }*/ for (int i=0;i<legs.length;i++) { legs[i].onUpdate(); legs[i].setLocationAndAngles(this.posX + 0.5, this.posY + 2, this.posZ, i*MathHelper.wrapDegrees(60)+Yaw, this.rotationPitch); } } } } public float getEyeHeight() { return 2.2F; } @Override public void setSwingingArms(boolean swingingArms) { } @Nonnull public World getWorld() { return this.world; } public void setNextLeg(LegGuardian leg){ for (int i = 0; i<legs.length;i++){ if (legs[i]==null){ legs[i]=leg; break; } } } /*@Override public boolean attackEntityFromPart(@Nonnull MultiPartEntityPart guardianPart,@Nonnull DamageSource source, float damage) { if (guardianPart==this.guardianEye){ damage=damage*2; } this.attackEntityFrom(source, damage); return true; }*/ public boolean attackEntityFromPart(LegGuardian legGuardian, DamageSource source, float damage) { if (damage < 0.01F) { return false; } else { if (source.getTrueSource() instanceof EntityPlayer || source.isExplosion()||source.getTrueSource() instanceof Guardian_Stalker) { float f = this.getHealth(); this.attackEntityFrom(source, damage); } return true; } } } MainEntityRenderer: package com.cruelar.cruelars_triforcemod.renderer; import com.cruelar.cruelars_triforcemod.entities.monster.Guardian_Stalker; import com.cruelar.cruelars_triforcemod.model.ModelGuardianStalkerBody; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; public class RenderGuardianStalker extends RenderLiving<Guardian_Stalker> { //Only basic stuff by now private ResourceLocation mobTexture = new ResourceLocation("cruelars_triforcemod:textures/entity/guardian_stalker.png"); public static final Factory FACTORY = new Factory(); public RenderGuardianStalker(RenderManager renderManager){ super(renderManager, new ModelGuardianStalkerBody(),2F); } @Nullable @Override protected ResourceLocation getEntityTexture(@Nonnull Guardian_Stalker entity) { return mobTexture; } public static class Factory implements IRenderFactory<Guardian_Stalker> { @Override public Render<? super Guardian_Stalker> createRenderFor(RenderManager manager){ return new RenderGuardianStalker(manager); } } } No Ai yet, only AI I made already since starting Modding were simple Copies of AINearestAttackableTarget LegEntityModel: package com.cruelar.cruelars_triforcemod.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; /** * GuardianLeg - Cruelar * Created using Tabula 7.0.0 */ public class GuardianLeg extends ModelBase { public ModelRenderer shape1; public ModelRenderer shape2; public ModelRenderer shape3; public ModelRenderer shape4; public ModelRenderer shape5; public ModelRenderer shape6; public ModelRenderer shape7; public ModelRenderer shape8; public ModelRenderer shape9; public ModelRenderer shape10; public ModelRenderer Footmain; public ModelRenderer Footright; public ModelRenderer Footleft; public ModelRenderer Footfront; public GuardianLeg() { this.textureWidth = 64; this.textureHeight = 32; this.shape8 = new ModelRenderer(this, 0, 0); this.shape8.mirror = true; this.shape8.setRotationPoint(0.0F, 12.0F, -21.0F); this.shape8.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape8, 0.5235987755982988F, -0.5235987755982988F, 0.7853981633974483F); this.shape3 = new ModelRenderer(this, 0, 0); this.shape3.setRotationPoint(0.0F, 10.0F, -6.0F); this.shape3.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape3, 0.17453292519943295F, 0.0F, 0.0F); this.shape5 = new ModelRenderer(this, 0, 0); this.shape5.setRotationPoint(0.0F, 11.0F, -12.0F); this.shape5.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape5, 0.2617993877991494F, 0.0F, 0.0F); this.Footfront = new ModelRenderer(this, 0, 8); this.Footfront.setRotationPoint(0.0F, 20.0F, -28.0F); this.Footfront.addBox(-2.0F, 0.0F, -7.0F, 4, 1, 5, 0.0F); this.setRotateAngle(Footfront, 0.5235987755982988F, -0.0F, 0.0F); this.shape2 = new ModelRenderer(this, 0, 0); this.shape2.mirror = true; this.shape2.setRotationPoint(0.0F, 10.0F, -3.0F); this.shape2.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape2, 0.08726646259971647F, -0.08726646259971647F, 0.7853981633974483F); this.shape7 = new ModelRenderer(this, 0, 0); this.shape7.setRotationPoint(0.0F, 12.0F, -18.0F); this.shape7.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape7, 0.3490658503988659F, 0.0F, 0.0F); this.shape4 = new ModelRenderer(this, 0, 0); this.shape4.mirror = true; this.shape4.setRotationPoint(0.0F, 10.0F, -9.0F); this.shape4.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape4, 0.17453292519943295F, -0.17453292519943295F, 0.7853981633974483F); this.Footleft = new ModelRenderer(this, 32, 0); this.Footleft.mirror = true; this.Footleft.setRotationPoint(0.0F, 20.0F, -28.0F); this.Footleft.addBox(2.0F, 0.0F, -2.0F, 5, 1, 4, 0.0F); this.setRotateAngle(Footleft, 0.0F, -0.0F, 0.5235987755982988F); this.shape6 = new ModelRenderer(this, 0, 0); this.shape6.mirror = true; this.shape6.setRotationPoint(0.0F, 11.0F, -15.0F); this.shape6.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape6, 0.2617993877991494F, -0.2617993877991494F, 0.7853981633974483F); this.shape9 = new ModelRenderer(this, 0, 0); this.shape9.setRotationPoint(0.0F, 14.0F, -24.0F); this.shape9.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape9, 0.7853981633974483F, 0.0F, 0.0F); this.shape1 = new ModelRenderer(this, 0, 0); this.shape1.setRotationPoint(0.0F, 10.0F, 0.0F); this.shape1.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape1, 0.08726646259971647F, 0.0F, 0.0F); this.Footmain = new ModelRenderer(this, 16, 0); this.Footmain.setRotationPoint(0.0F, 20.0F, -28.0F); this.Footmain.addBox(-2.0F, 0.0F, -2.0F, 4, 4, 4, 0.0F); this.Footright = new ModelRenderer(this, 32, 0); this.Footright.setRotationPoint(0.0F, 20.0F, -28.0F); this.Footright.addBox(-7.0F, 0.0F, -2.0F, 5, 1, 4, 0.0F); this.setRotateAngle(Footright, 0.0F, -0.0F, -0.5235987755982988F); this.shape10 = new ModelRenderer(this, 0, 0); this.shape10.mirror = true; this.shape10.setRotationPoint(0.0F, 17.0F, -26.0F); this.shape10.addBox(-2.0F, -2.0F, -4.0F, 4, 4, 4, 0.0F); this.setRotateAngle(shape10, 0.7853981633974483F, -0.7853981633974483F, 0.7853981633974483F); } @Override @SideOnly(Side.CLIENT) public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.shape8.render(f5); this.shape3.render(f5); this.shape5.render(f5); this.Footfront.render(f5); this.shape2.render(f5); this.shape7.render(f5); this.shape4.render(f5); this.Footleft.render(f5); this.shape6.render(f5); this.shape9.render(f5); this.shape1.render(f5); this.Footmain.render(f5); this.Footright.render(f5); this.shape10.render(f5); } /** * This is a helper function from Tabula to set the rotation of model parts */ public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } Leg class: package com.cruelar.cruelars_triforcemod.entities.monster; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import java.util.List; import java.util.UUID; public class LegGuardian extends EntityMob{ public static final ResourceLocation RESOURCE_LOCATION = new ResourceLocation("cruelars_triforcemod:textures/entity/guardian_leg.png"); public UUID parent; public String partName; public LegGuardian(World world){ super(world); init(); } @Override public String toString() { return String.format("%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName(), this.getEntityId(), this.world == null ? "~NULL~" : this.world.getWorldInfo().getWorldName(), this.posX, this.posY, this.posZ); } @Override protected void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(100.0D); this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(10.0D); } private void init() { this.setSize(1.5F, 1.0F); this.ignoreFrustumCheck = true; } public void setParent(Guardian_Stalker parent) { this.parent = parent.getUniqueID(); } public Guardian_Stalker getParent() { return this.getEntityByUUID(parent,this.world); } public void setPartName(String partName) { this.partName = partName; } public String getPartName() { return partName; } protected void onDeathUpdate() { ++this.deathTime; if (this.deathTime == 20) { if (parent!=null) { this.getEntityByUUID(parent, this.world).attackEntityFrom(DamageSource.causeIndirectDamage(this, this.getEntityByUUID(parent, this.world)), 100.0F); } this.setDead(); for (int k = 0; k < 20; ++k) { double d2 = this.rand.nextGaussian() * 0.02D; double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; this.world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d2, d0, d1); } } } @Override protected void entityInit() { super.entityInit(); } @Override public void readEntityFromNBT(NBTTagCompound compound) { Entity entity = getEntityByUUID(compound.getUniqueId("parent"), world); if (entity != null) { ((Guardian_Stalker)entity).setNextLeg(this); parent = ((Guardian_Stalker)entity).getUniqueID(); } } @Override public void writeEntityToNBT(NBTTagCompound compound) { if (parent!=null) { compound.setUniqueId("parent", parent); } } public boolean isEntityEqual(Entity entityIn) { return parent != null && (this == entityIn || this.parent == entityIn.getUniqueID()); } private Guardian_Stalker getEntityByUUID(UUID entityUUID, World worldIn){ int lenght =worldIn.loadedEntityList.size(); List<Entity> loadedEntityList= worldIn.loadedEntityList; Guardian_Stalker foundEntity = null; for (int i = 0;i<lenght;i++){ if (loadedEntityList.get(i).getUniqueID()==entityUUID){ foundEntity = (Guardian_Stalker) loadedEntityList.get(i); } } return foundEntity; } } LegRenderer: package com.cruelar.cruelars_triforcemod.renderer; import com.cruelar.cruelars_triforcemod.entities.monster.LegGuardian; import com.cruelar.cruelars_triforcemod.model.ModelGuardianLeg; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; public class RenderGuardianLeg extends RenderLiving<LegGuardian> { //Only basic stuff by now private ResourceLocation mobTexture = new ResourceLocation("cruelars_triforcemod:textures/entity/guardian_leg.png"); public static final Factory FACTORY = new Factory(); public RenderGuardianLeg(RenderManager renderManager){ super(renderManager, new ModelGuardianLeg(),0.5F); } @Nullable @Override protected ResourceLocation getEntityTexture(@Nonnull LegGuardian entity) { return mobTexture; } public static class Factory implements IRenderFactory<LegGuardian> { @Override public Render<? super LegGuardian> createRenderFor(RenderManager manager){ return new RenderGuardianLeg(manager); } } } Rest I have'nt started yet Really any help is appreciated. I f the Way I use the Forum here to get lots of Information to this one thing dear moderators please just warn me. I'll then only ask for specific stuff but as this is a big project I thought I need all help I can get.
-
[1.12.2]Problem with changing an Item in Player Inventory
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
Yes but first typed the ! so I continued with that. -
[1.12.2]Problem with changing an Item in Player Inventory
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
No. Check your logic again. You have something extra. in onUpdate() For the other thanks -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
Problem: with You can stand in it at its edge. NULL_AABB results in random crashes log is in post above from 1st August What should I do? -
[1.12.2]Problem with changing an Item in Player Inventory
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
And what the fuck is this? Earlier I had a Problem with getting the DurabilityBar for my Item and at that time I was really really new to mc modding. As it worked I never looked at it again, altough I think it wasn't that what solved my Problem. You also have this, which is also wrong, for the same reason I mentioned earlier. Removed it from BrokenMastersword and I'm working on it in TrueMastersword but I've trouble with that @Override public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot entityEquipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(entityEquipmentSlot); if (entityEquipmentSlot == EntityEquipmentSlot.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", attack_damage+getAttackDamage()*10, 0)); } return multimap; } I need a Itemstack but don't have one. What should I do? More like that? public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (!getTagCompoundSafe(stack).hasKey("cooldown")){ getTagCompoundSafe(stack).setInteger("cooldown",(int)worldIn.getWorldTime()+12000); } if (!(getTagCompoundSafe(stack).getInteger("cooldown")>worldIn.getWorldTime())){ getTagCompoundSafe(stack).removeTag("cooldown"); True_Master_Sword true_master_sword= ModItems.true_master_sword; true_master_sword.setUpgradeCount(this.getTagCompoundSafe(stack).getInteger("UpgradeCount"),stack); ItemStack itemStack = new ItemStack(true_master_sword); entityIn.replaceItemInInventory(itemSlot,itemStack); } } @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if (worldIn!=null){ tooltip.add(1,"Cooldowntime remaining: "+convertTicksToTime(getTagCompoundSafe(stack).getInteger("cooldown")-(int)worldIn.getWorldTime())); } } private NBTTagCompound getTagCompoundSafe(ItemStack stack) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { tagCompound = new NBTTagCompound(); stack.setTagCompound(tagCompound); } return tagCompound; } public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return !oldStack.equals(newStack)||(newStack.getItem() instanceof Broken_Master_Sword && oldStack.getItem() instanceof Broken_Master_Sword); //!ItemStack.areItemStacksEqual(oldStack, newStack); } private String convertTicksToTime(int ticktime){ String minutes = ""; int counter = 0; int time=ticktime; while (time>=1200){ time=time-1200; counter++; } minutes = minutes + counter; String seconds=""; counter=0; while (time>=20){ time=time-20; counter++; } if (counter<10){ seconds = "0"+counter; } else { seconds = seconds + counter; } return minutes+":"+seconds; } } Yes I already noticed. -
[1.12.2]Problem with changing an Item in Player Inventory
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
Broken Mastersword: package com.cruelar.cruelars_triforcemod.items; import com.cruelar.cruelars_triforcemod.Cruelars_Triforcemod_Core; import com.cruelar.cruelars_triforcemod.init.ModItems; import com.cruelar.cruelars_triforcemod.inventory.cruelars_triforcemod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; import java.util.List; import java.util.Objects; public class Broken_Master_Sword extends Item { private int upgradeCount; public Broken_Master_Sword(){ this.setRegistryName("broken_master_sword"); this.setUnlocalizedName(Cruelars_Triforcemod_Core.MODID+".broken_master_sword"); this.setCreativeTab(cruelars_triforcemod.CRUELARS_TRIFORCEMOD_WEAPONS); this.setMaxStackSize(1); upgradeCount=0; } public void setUpgradeCount(int count,ItemStack stack){ getTagCompoundSafe(stack).setInteger("UpgradeCount",count); } public int getUpgradeCount(ItemStack stack){ return getTagCompoundSafe(stack).getInteger("UpgradeCount"); } @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(Objects.requireNonNull(getRegistryName()), "inventory")); } public EnumRarity getRarity(ItemStack stack) { return EnumRarity.COMMON; } public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) { return false; } public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return false; } public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (!getTagCompoundSafe(stack).hasKey("cooldown")){ getTagCompoundSafe(stack).setInteger("cooldown",12000); } int cooldown = getTagCompoundSafe(stack).getInteger("cooldown"); if (cooldown==0){ getTagCompoundSafe(stack).removeTag("cooldown"); True_Master_Sword true_master_sword= ModItems.true_master_sword; true_master_sword.setUpgradeCount(upgradeCount); ItemStack itemStack = new ItemStack(true_master_sword); entityIn.replaceItemInInventory(itemSlot,itemStack); cooldown=12000; } cooldown--; getTagCompoundSafe(stack).setInteger("cooldown",cooldown); } @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { tooltip.add(1,"Cooldowntime remaining: "+convertTicksToTime(getTagCompoundSafe(stack).getInteger("cooldown"))); } private NBTTagCompound getTagCompoundSafe(ItemStack stack) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { tagCompound = new NBTTagCompound(); stack.setTagCompound(tagCompound); } return tagCompound; } public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return !oldStack.equals(newStack)||(newStack.getItem() instanceof Broken_Master_Sword && oldStack.getItem() instanceof Broken_Master_Sword); //!ItemStack.areItemStacksEqual(oldStack, newStack); } private String convertTicksToTime(int ticktime){ String minutes = ""; int counter = 0; int time=ticktime; while (time>=1200){ time=time-1200; counter++; } minutes = minutes + counter; String seconds=""; counter=0; while (time>=20){ time=time-20; counter++; } if (counter<10){ seconds = "0"+counter; } else { seconds = seconds + counter; } return minutes+":"+seconds; } } Mastersword: package com.cruelar.cruelars_triforcemod.items; import com.cruelar.cruelars_triforcemod.Cruelars_Triforcemod_Core; import com.cruelar.cruelars_triforcemod.init.ModItems; import com.cruelar.cruelars_triforcemod.inventory.cruelars_triforcemod; import com.google.common.collect.Multimap; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.Objects; public class True_Master_Sword extends ItemSword { public static ItemStack true_master_sword; private double attack_damage; private int damage; public int upgradeCount=0; public True_Master_Sword() { super(ModItems.mastermetal); true_master_sword = new ItemStack(this); setRegistryName("true_master_sword"); setUnlocalizedName(Cruelars_Triforcemod_Core.MODID + ".true_master_sword"); this.isDamageable(); this.setMaxDamage(40); this.showDurabilityBar(true_master_sword); attack_damage = 29.0D; setCreativeTab(cruelars_triforcemod.CRUELARS_TRIFORCEMOD_WEAPONS); this.getDurabilityForDisplay(true_master_sword); this.getItemStackDisplayName(true_master_sword); } public void setUpgradeCount(int count){ this.upgradeCount=count; } public int getUpgradeCount(){ return this.upgradeCount; } public float getAttackDamage() { return (float)this.attack_damage+upgradeCount*10; } @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(Objects.requireNonNull(getRegistryName()), "inventory")); } public void setAttack_damage(){ while (getDamage(true_master_sword) >= 249){ attack_damage = -4.0D; } } public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) { return false; } public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return false; } private NBTTagCompound getTagCompoundSafe(ItemStack stack) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { tagCompound = new NBTTagCompound(); stack.setTagCompound(tagCompound); } return tagCompound; } public EnumRarity getRarity(ItemStack stack) { return EnumRarity.EPIC; } @Override public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot entityEquipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(entityEquipmentSlot); if (entityEquipmentSlot == EntityEquipmentSlot.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", attack_damage+upgradeCount*10, 0)); } return multimap; } public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { int upgradeCount = this.getUpgradeCount(); String customName = this.getItemStackDisplayName(stack); stack.damageItem(1, attacker); if (stack.getItem().getDamage(stack)==40){ Broken_Master_Sword broken_master_sword = ModItems.broken_master_sword; stack=new ItemStack(broken_master_sword); broken_master_sword.setUpgradeCount(upgradeCount, stack); attacker.setItemStackToSlot(EntityEquipmentSlot.MAINHAND,stack ); } return true; } public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { if ((double)state.getBlockHardness(worldIn, pos) != 0.0D) { int upgradeCount = this.getUpgradeCount(); String customName = this.getItemStackDisplayName(stack); stack.damageItem(2, entityLiving); if (stack.getItem().getDamage(stack)==40){ Broken_Master_Sword broken_master_sword = ModItems.broken_master_sword; stack=new ItemStack(broken_master_sword); broken_master_sword.setUpgradeCount(upgradeCount, stack); entityLiving.setItemStackToSlot(EntityEquipmentSlot.MAINHAND,stack ); } } return true; } } It works. Can I have a cookie now?? -
[1.12.2]Problem with changing an Item in Player Inventory
_Cruelar_ posted a topic in Modder Support
So I have two Items. One is a sword with 30 attack damage an 40 durability and the other is a broken version of it into which the first item changes when it's durability reaches zero. The second Item will change back into the first after 10 minutes. My Problem is the cooldown time of the broken version applies to all broken version items. Also it is equal in between saves. I would like to safe the cooldown time for every item not globally. My Code: The Mastersword: package com.cruelar.cruelars_triforcemod.items; import com.cruelar.cruelars_triforcemod.Cruelars_Triforcemod_Core; import com.cruelar.cruelars_triforcemod.init.ModItems; import com.cruelar.cruelars_triforcemod.inventory.cruelars_triforcemod; import com.google.common.collect.Multimap; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.Objects; public class True_Master_Sword extends ItemSword { public static ItemStack true_master_sword; private double attack_damage; private int damage; public int upgradeCount=0; public True_Master_Sword() { super(ModItems.mastermetal); true_master_sword = new ItemStack(this); setRegistryName("true_master_sword"); setUnlocalizedName(Cruelars_Triforcemod_Core.MODID + ".true_master_sword"); this.isDamageable(); this.setMaxDamage(40); this.showDurabilityBar(true_master_sword); attack_damage = 29.0D; setCreativeTab(cruelars_triforcemod.CRUELARS_TRIFORCEMOD_WEAPONS); this.getDurabilityForDisplay(true_master_sword); this.getItemStackDisplayName(true_master_sword); } public void setUpgradeCount(int count){ this.upgradeCount=count; } public int getUpgradeCount(){ return this.upgradeCount; } public float getAttackDamage() { return (float)this.attack_damage+upgradeCount*10; } @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(Objects.requireNonNull(getRegistryName()), "inventory")); } public void setAttack_damage(){ while (getDamage(true_master_sword) >= 249){ attack_damage = -4.0D; } } public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) { return false; } public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return false; } private NBTTagCompound getTagCompoundSafe(ItemStack stack) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { tagCompound = new NBTTagCompound(); stack.setTagCompound(tagCompound); } return tagCompound; } public EnumRarity getRarity(ItemStack stack) { return EnumRarity.EPIC; } @Override public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot entityEquipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(entityEquipmentSlot); if (entityEquipmentSlot == EntityEquipmentSlot.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", attack_damage+upgradeCount*10, 0)); } return multimap; } public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { int upgradeCount = this.getUpgradeCount(); String customName = this.getItemStackDisplayName(stack); stack.damageItem(1, attacker); if (stack.getItem().getDamage(stack)==40){ Broken_Master_Sword broken_master_sword = ModItems.broken_master_sword; broken_master_sword.setUpgradeCount(upgradeCount); broken_master_sword.setCustomName(customName); stack=new ItemStack(broken_master_sword); attacker.setItemStackToSlot(EntityEquipmentSlot.MAINHAND,stack ); } return true; } public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { if ((double)state.getBlockHardness(worldIn, pos) != 0.0D) { int upgradeCount = this.getUpgradeCount(); String customName = this.getItemStackDisplayName(stack); stack.damageItem(2, entityLiving); if (stack.getItem().getDamage(stack)==40){ Broken_Master_Sword broken_master_sword = ModItems.broken_master_sword; broken_master_sword.setUpgradeCount(upgradeCount); broken_master_sword.setCustomName(customName); stack=new ItemStack(broken_master_sword); entityLiving.setItemStackToSlot(EntityEquipmentSlot.MAINHAND,stack ); } } return true; } } The broken Mastersword: package com.cruelar.cruelars_triforcemod.items; import com.cruelar.cruelars_triforcemod.Cruelars_Triforcemod_Core; import com.cruelar.cruelars_triforcemod.init.ModItems; import com.cruelar.cruelars_triforcemod.inventory.cruelars_triforcemod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; import java.util.List; import java.util.Objects; public class Broken_Master_Sword extends Item { private int cooldown; private int upgradeCount; private String customName; public Broken_Master_Sword(){ this.setRegistryName("broken_master_sword"); this.setUnlocalizedName(Cruelars_Triforcemod_Core.MODID+".broken_master_sword"); this.setCreativeTab(cruelars_triforcemod.CRUELARS_TRIFORCEMOD_WEAPONS); this.setMaxStackSize(1); this.setCooldown(12000); upgradeCount=0; } public void setUpgradeCount(int count){ this.upgradeCount=count; } public int getUpgradeCount(){ return this.upgradeCount; } public void setCustomName(String customName){ this.customName=customName; } public String getCustomName() { return customName; } public void setCooldown(int cooldown){ this.cooldown=cooldown; } @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(Objects.requireNonNull(getRegistryName()), "inventory")); } public EnumRarity getRarity(ItemStack stack) { return EnumRarity.COMMON; } public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) { return false; } public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return false; } public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (getTagCompoundSafe(stack).getInteger("cooldown")!=0){ cooldown = getTagCompoundSafe(stack).getInteger("cooldown"); } if (cooldown==0){ getTagCompoundSafe(stack).removeTag("cooldown"); True_Master_Sword true_master_sword= ModItems.true_master_sword; true_master_sword.setUpgradeCount(upgradeCount); ItemStack itemStack = new ItemStack(true_master_sword); if (customName!=null) { itemStack.setStackDisplayName(customName); } entityIn.replaceItemInInventory(itemSlot,itemStack); cooldown=12000; } cooldown--; getTagCompoundSafe(stack).setInteger("cooldown",cooldown); } @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { tooltip.add(1,"Cooldowntime remaining: "+convertTicksToTime(cooldown)); } private NBTTagCompound getTagCompoundSafe(ItemStack stack) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { tagCompound = new NBTTagCompound(); stack.setTagCompound(tagCompound); } return tagCompound; } public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return !oldStack.equals(newStack)||(newStack.getItem() instanceof Broken_Master_Sword && oldStack.getItem() instanceof Broken_Master_Sword); //!ItemStack.areItemStacksEqual(oldStack, newStack); } private String convertTicksToTime(int ticktime){ String minutes = ""; int counter = 0; int time=ticktime; while (time>=1200){ time=time-1200; counter++; } minutes = minutes + counter; String seconds=""; counter=0; while (time>=20){ time=time-20; counter++; } if (counter<10){ seconds = "0"+counter; } else { seconds = seconds + counter; } return minutes+":"+seconds; } } -
You could try to make it like the Vanilla door
-
I experimented a bit and now I have two one entity: One that behaves like before and one with the right size and almost the right behavior. Here's my updated code: Item: package com.cruelar.cruelars_triforcemod.items; import com.cruelar.cruelars_triforcemod.Cruelars_Triforcemod_Core; import com.cruelar.cruelars_triforcemod.entities.projectiles.Clawshot_Head; import com.cruelar.cruelars_triforcemod.inventory.cruelars_triforcemod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; import java.util.List; import java.util.Objects; import java.util.UUID; public class Clawshot_TP extends Item { public Entity entity; public Clawshot_TP(){ this.setCreativeTab(cruelars_triforcemod.CRUELARS_TRIFORCEMOD); this.setRegistryName("clawshot_tp"); this.setUnlocalizedName(Cruelars_Triforcemod_Core.MODID+".clawshot_tp"); this.addPropertyOverride(new ResourceLocation("cast"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack p_apply_1_, @Nullable World p_apply_2_, @Nullable EntityLivingBase p_apply_3_) { if (p_apply_3_ == null) { return 0.0F; } else { boolean lvt_4_1_ = p_apply_3_.getHeldItemMainhand() == p_apply_1_; boolean lvt_5_1_ = p_apply_3_.getHeldItemOffhand() == p_apply_1_; if (p_apply_3_.getHeldItemMainhand().getItem() instanceof Clawshot_TP) { lvt_5_1_ = false; } return (lvt_4_1_ || lvt_5_1_) && p_apply_3_ instanceof EntityPlayer && entity != null ? 1.0F : 0.0F; } } }); } @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer entityPlayer,EnumHand enumHand) { ItemStack itemStack = entityPlayer.getHeldItem(enumHand); if (world.isRemote){ if (!this.getTagCompoundSafe(itemStack).hasKey("shot") || !this.getTagCompoundSafe(itemStack).getBoolean("shot") || this.getEntityByUUID(Objects.requireNonNull(this.getTagCompoundSafe(itemStack).getUniqueId("head")),world,itemStack)!=null && this.getEntityByUUID(Objects.requireNonNull(this.getTagCompoundSafe(itemStack).getUniqueId("head")),world,itemStack).isDead) { Clawshot_Head clawshot_head = new Clawshot_Head(world, entityPlayer); clawshot_head.shoot(entityPlayer); world.spawnEntity(clawshot_head); this.getTagCompoundSafe(itemStack).setBoolean("shot",true); this.getTagCompoundSafe(itemStack).setUniqueId("head",clawshot_head.getUniqueID()); } else if (this.getEntityByUUID(this.getTagCompoundSafe(itemStack).getUniqueId("head"),world,itemStack)!=null){ this.getEntityByUUID(this.getTagCompoundSafe(itemStack).getUniqueId("head"),world,itemStack).setDead(); this.getTagCompoundSafe(itemStack).setBoolean("shot",false); } } return new ActionResult(EnumActionResult.SUCCESS,itemStack); } @SideOnly(Side.CLIENT) public void initModel(){ ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(Objects.requireNonNull(getRegistryName()), "inventory")); } private NBTTagCompound getTagCompoundSafe(ItemStack stack) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { tagCompound = new NBTTagCompound(); stack.setTagCompound(tagCompound); } return tagCompound; } private Entity getEntityByUUID(UUID entityUUID, World worldIn, ItemStack itemStack){ int lenght =worldIn.loadedEntityList.size(); List<Entity> loadedEntityList= worldIn.loadedEntityList; Entity foundEntity = null; for (int i = 0;i<lenght;i++){ if (loadedEntityList.get(i).getUniqueID()==entityUUID){ foundEntity = loadedEntityList.get(i); } } entity=foundEntity; return foundEntity; } } Entity: package com.cruelar.cruelars_triforcemod.entities.projectiles; import io.netty.buffer.ByteBuf; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.MoverType; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.*; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.Iterator; import java.util.List; import java.util.UUID; public class Clawshot_Head extends Entity implements IEntityAdditionalSpawnData{ private UUID entityPlayer; public Entity caughtEntity; public Clawshot_Head.State currentState; private static final DataParameter<Integer> DATA_HOOKED_ENTITY; private boolean inGround; private int ticksInAir; private int ticksInGround; public static final ResourceLocation RESOURCE_LOCATION=new ResourceLocation("cruelars_triforcemod:textures/entity/projectiles/clawshot_head.png"); public Clawshot_Head(World world){ super(world); } public Clawshot_Head(World world, EntityPlayer entityPlayer){ super(world); this.init(entityPlayer); this.currentState = Clawshot_Head.State.FLYING; this.setPosition((double)entityPlayer.posX,(double)entityPlayer.posY+entityPlayer.getEyeHeight(),(double)entityPlayer.posZ); //this.shoot(entityPlayer); // Changed that as it is called before readSpawnData and writeSpawnData this.setNoGravity(true); } @SideOnly(Side.CLIENT) public Clawshot_Head(World world, EntityPlayer entityPlayer, double posX, double posY, double posZ) { super(world); this.init(entityPlayer); this.setPosition(posX,posY,posZ); this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; } public void notifyDataManagerChange(DataParameter<?> p_notifyDataManagerChange_1_) { if (DATA_HOOKED_ENTITY.equals(p_notifyDataManagerChange_1_)) { int i = (Integer)this.getDataManager().get(DATA_HOOKED_ENTITY); this.caughtEntity = i > 0 ? this.world.getEntityByID(i - 1) : null; } super.notifyDataManagerChange(p_notifyDataManagerChange_1_); } public void onUpdate() { super.onUpdate(); if (this.entityPlayer == null) { System.out.println("ln:70 got called"); this.setDead(); } else if (this.world.isRemote) { if (this.inGround) { ++this.ticksInGround; motionX = 0; motionY = 0; motionZ = 0; } if(this.collidedHorizontally){ motionX=0; motionY=0; motionZ=0; ++this.ticksInGround; } if(this.getDistance(getEntityByUUID(entityPlayer,world))>=64){ System.out.println("ln:92 got called"); this.setDead(); } BlockPos blockpos = new BlockPos(this); IBlockState iblockstate = this.world.getBlockState(blockpos); if (this.currentState == Clawshot_Head.State.FLYING) { if (this.caughtEntity != null) { this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.currentState = Clawshot_Head.State.HOOKED_IN_ENTITY; return; } if (!this.world.isRemote) { this.checkCollision(); } } else { if (this.currentState == Clawshot_Head.State.HOOKED_IN_ENTITY) { if (this.caughtEntity != null) { if (this.caughtEntity.isDead) { this.caughtEntity = null; this.currentState = Clawshot_Head.State.FLYING; } else { this.posX = this.caughtEntity.posX; double d2 = (double)this.caughtEntity.height; this.posY = this.caughtEntity.getEntityBoundingBox().minY + d2 * 0.8D; this.posZ = this.caughtEntity.posZ; this.setPosition(this.posX, this.posY, this.posZ); } } return; } } this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ); this.updateRotation(); this.setPosition(this.posX, this.posY, this.posZ); } if (this.ticksInAir>20){ this.setDead(); } if (this.ticksInGround >= 1200) { System.out.println("ln:147 got called"); this.setDead(); } } private void updateRotation() { float f = MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float)(MathHelper.atan2(this.motionX, this.motionZ) * (180D / Math.PI)); for (this.rotationPitch = (float)(MathHelper.atan2(this.motionY, (double)f) * (180D / Math.PI)); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { } while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; } public void shoot(Entity entity) { System.out.println(entity); this.motionX=0.6D*entity.getLookVec().x; this.motionY=0.6D*entity.getLookVec().y; this.motionZ=0.6D*entity.getLookVec().z; } public void shoot(double p_shoot_1_, double p_shoot_3_, double p_shoot_5_, float p_shoot_7_, float p_shoot_8_){} public int handleHookRetraction() { if (!this.world.isRemote && this.entityPlayer != null) { int i = 0; if (this.caughtEntity != null) { this.bringInHookedEntity(); this.world.setEntityState(this, (byte)31); i = this.caughtEntity instanceof EntityItem ? 3 : 5; } else if (this.inGround) { i = 2; } this.setDead(); return i; } else { return 0; } } protected void bringInHookedEntity() { if (this.getEntityByUUID(entityPlayer,world) != null) { double d0 = this.getEntityByUUID(entityPlayer,world).posX - this.posX; double d1 = this.getEntityByUUID(entityPlayer,world).posY - this.posY; double d2 = this.getEntityByUUID(entityPlayer,world).posZ - this.posZ; double d3 = 0.1D; this.caughtEntity.motionX += d0 * d3; this.caughtEntity.motionY += d1 * d3; this.caughtEntity.motionZ += d2 * d3; } } public void setDead() { super.setDead(); } public EntityPlayer getAngler() { return this.getEntityByUUID(entityPlayer,this.world); } private EntityPlayer getEntityByUUID(UUID entityUUID, World worldIn){ int lenght =worldIn.loadedEntityList.size(); List<Entity> loadedEntityList= worldIn.loadedEntityList; EntityPlayer foundEntity = null; for (int i = 0;i<lenght;i++){ if (loadedEntityList.get(i).getUniqueID()==entityUUID){ if (loadedEntityList.get(i) instanceof EntityPlayer) { foundEntity = (EntityPlayer) loadedEntityList.get(i); } } } return foundEntity; } private void init(EntityPlayer p_init_1_) { this.setSize(0.25F, 0.25F); this.ignoreFrustumCheck = true; this.entityPlayer = p_init_1_.getUniqueID(); } private void checkCollision() { Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ); Vec3d vec3d1 = new Vec3d(this.posX + 0.2, this.posY + 0.2, this.posZ + 0.2); RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d, vec3d1, false, true, false); vec3d = new Vec3d(this.posX, this.posY, this.posZ); vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (raytraceresult != null) { vec3d1 = new Vec3d(raytraceresult.hitVec.x, raytraceresult.hitVec.y, raytraceresult.hitVec.z); this.inGround=true; this.motionX=0; this.motionY=0; this.motionZ=0; getEntityByUUID(entityPlayer,this.world).posX=this.posX; getEntityByUUID(entityPlayer,this.world).posY=this.posY; getEntityByUUID(entityPlayer,this.world).posZ=this.posZ; } Entity entity = null; List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(this.motionX, this.motionY, this.motionZ).grow(1.0D)); double d0 = 0.0D; Iterator var8 = list.iterator(); while(true) { Entity entity1; double d1; do { RayTraceResult raytraceresult1; do { do { do { if (!var8.hasNext()) { if (entity != null) { raytraceresult = new RayTraceResult(entity); } if (raytraceresult != null && raytraceresult.typeOfHit != RayTraceResult.Type.MISS) { if (raytraceresult.typeOfHit == RayTraceResult.Type.ENTITY) { this.caughtEntity = raytraceresult.entityHit; this.setHookedEntity(); } else { this.inGround = true; } } return; } entity1 = (Entity)var8.next(); } while(!this.canBeHooked(entity1)); } while(entity1 == this.getEntityByUUID(entityPlayer,this.world) && this.ticksInAir < 5); AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(0.30000001192092896D); raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1); } while(raytraceresult1 == null); d1 = vec3d.squareDistanceTo(raytraceresult1.hitVec); } while(d1 >= d0 && d0 != 0.0D); entity = entity1; d0 = d1; } } private void setHookedEntity() { this.getDataManager().set(DATA_HOOKED_ENTITY, this.caughtEntity.getEntityId() + 1); } protected boolean canBeHooked(Entity p_canBeHooked_1_) { return p_canBeHooked_1_.canBeCollidedWith() || p_canBeHooked_1_ instanceof EntityItem; } protected void entityInit() { this.getDataManager().register(DATA_HOOKED_ENTITY, 0); } @Override protected void readEntityFromNBT(NBTTagCompound nbtTagCompound) { } @Override protected void writeEntityToNBT(NBTTagCompound nbtTagCompound) { } static { DATA_HOOKED_ENTITY = EntityDataManager.createKey(Clawshot_Head.class, DataSerializers.VARINT); } @Override public void writeSpawnData(ByteBuf buffer) { buffer.writeBoolean(getEntityByUUID(entityPlayer,this.world)==null); if (getEntityByUUID(entityPlayer,this.world)!=null) { buffer.writeInt(getEntityByUUID(entityPlayer,this.world).getEntityId()); } } @Override public void readSpawnData(ByteBuf additionalData) { boolean nullPlayer = additionalData.readBoolean(); if (!nullPlayer){ EntityPlayer entityByID=(EntityPlayer) world.getEntityByID(additionalData.readInt()); if (entityByID!=null){ entityPlayer=entityByID.getUniqueID(); } //this.shoot(getEntityByUUID(entityPlayer,this.world)); //changed that because it is only called on one Side. Obviously the wrong side. } } static enum State { FLYING, HOOKED_IN_ENTITY; private State() { } } } New log output when shooting: It dies from me being to far away. Remaining Problems: I can't retract it and can't use the Item more than one time. I would like to have a line drawn between the Entity and me. Quite similar to the fishing hook.
-
[Solved][1.12.2]How to get a model for a block
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
Strangely he moves the textures into the build/libs jar. Also doesn't work outside the dev environment. Is a specific size needed for the textures? like 16x16. Because only mirror_front.png (Number 4) is this size. -
[Solved][1.12.2]How to get a model for a block
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
While executing build I get this Where should I put the -Xlint:unchecked to follow the info in the log? I never had to do something like that. -
Optifine has also a non-forge version
-
[Solved][1.12.2]How to get a model for a block
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
Block: package com.cruelar.cruelars_triforcemod.blocks; import com.cruelar.cruelars_triforcemod.Cruelars_Triforcemod_Core; import com.cruelar.cruelars_triforcemod.tileentity.MirrorOfTwilight_TileEntity; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; public class BlockMirrorOfTwilight /*extends BlockContainer*/extends Block { public static final PropertyDirection FACING = BlockHorizontal.FACING; public BlockMirrorOfTwilight(){ super(Material.ROCK); this.setRegistryName("block_mirror_of_twilight"); this.setUnlocalizedName(Cruelars_Triforcemod_Core.MODID+".block_mirror_of_twilight"); } @Nullable @SuppressWarnings("deprecation") @Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return new AxisAlignedBB(0,0,0,1,2,1); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, FACING); } @SideOnly(Side.CLIENT) public void initModel(){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory")); } @Override @SuppressWarnings("deprecation") public boolean isBlockNormalCube(IBlockState blockState){ return false; } @Override @SuppressWarnings("deprecation") public boolean isOpaqueCube(IBlockState blockState){ return false; } @Override @SuppressWarnings("deprecation") public boolean isFullBlock(IBlockState state) { return false; } @Override @SuppressWarnings("deprecation") public boolean isTopSolid(IBlockState state) { return false; } @Override @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { return getDefaultState() .withProperty(FACING, EnumFacing.getHorizontal(meta & 5)); } @Override public int getMetaFromState(IBlockState blockState) { return blockState.getValue(FACING).getHorizontalIndex(); } public static EnumFacing getFacingFromEntity(BlockPos clickedBlock, EntityLivingBase entity) { return EnumFacing.getFacingFromVector( (float) (entity.posX - clickedBlock.getX()), (float) 0, (float) (entity.posZ - clickedBlock.getZ())); } @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { world.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); } @Override @SuppressWarnings("deprecation") public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED; } } blockstate json { "forge_marker": 1, "defaults": { "custom":{}, "model": "cruelars_triforcemod:block_mirror_of_twilight" }, "variants": { "normal": [{}], "inventory": [{}], "facing": { "north": {}, "south": {"y":180}, "west": {"y":270}, "east": {"y":90} } } } model json { "credit": "Made with Blockbench", "textures": { "0": "cruelars_triforcemod:blocks/mirror_front", "1": "cruelars_triforcemod:blocks/mirror_gold", "2": "cruelars_triforcemod:blocks/mirror_gold_striped", "3": "cruelars_triforcemod:blocks/mirror_dark", "4": "cruelars_triforcemod:blocks/mirror_back", "5": "cruelars_triforcemod:blocks/mirror_dark_striped" }, "elements": [ { "from": [6, 0, 6], "to": [10, 4, 10], "rotation": {"angle": 0, "axis": "y", "origin": [8, 2, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#2"}, "east": {"uv": [0, 0, 16, 16], "texture": "#2"}, "south": {"uv": [0, 0, 16, 16], "texture": "#2"}, "west": {"uv": [0, 0, 16, 16], "texture": "#2"}, "up": {"uv": [0, 0, 4, 4], "texture": "#1"}, "down": {"uv": [0, 0, 4, 4], "texture": "#1"} } }, { "from": [7, 4, 7], "to": [9, 6, 9], "rotation": {"angle": 0, "axis": "y", "origin": [8, 5, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#5"}, "east": {"uv": [0, 0, 16, 16], "texture": "#5"}, "south": {"uv": [0, 0, 16, 16], "texture": "#5"}, "west": {"uv": [0, 0, 16, 16], "texture": "#5"} } }, { "from": [6, 6, 6], "to": [10, 8, 10], "rotation": {"angle": 0, "axis": "y", "origin": [8, 7, 8]}, "faces": { "north": {"uv": [0, 0, 16, 8], "texture": "#2"}, "east": {"uv": [0, 0, 16, 8], "texture": "#2"}, "south": {"uv": [0, 0, 16, 8], "texture": "#2"}, "west": {"uv": [0, 0, 16, 8], "texture": "#2"}, "up": {"uv": [0, 0, 4, 2], "texture": "#1"}, "down": {"uv": [0, 0, 4, 2], "texture": "#1"} } }, { "from": [0, 6, 7], "to": [16, 8, 9], "rotation": {"angle": 0, "axis": "y", "origin": [8, 7, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#5"}, "east": {"uv": [0, 0, 16, 16], "texture": "#5"}, "south": {"uv": [0, 0, 16, 16], "texture": "#5"}, "west": {"uv": [0, 0, 16, 16], "texture": "#5"}, "up": {"uv": [0, 0, 1, 1], "texture": "#3"}, "down": {"uv": [0, 0, 1, 1], "texture": "#3"} } }, { "from": [0, 8, 7], "to": [2, 16, 9], "rotation": {"angle": 0, "axis": "y", "origin": [1, 12, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#5", "rotation": 270}, "east": {"uv": [0, 0, 1, 1], "texture": "#3"}, "south": {"uv": [0, 0, 16, 16], "texture": "#5", "rotation": 90}, "west": {"uv": [0, 0, 8, 2], "texture": "#5", "rotation": 90}, "up": {"uv": [0, 0, 2, 2], "texture": "#3"} } }, { "from": [14, 8, 7], "to": [16, 16, 9], "rotation": {"angle": 0, "axis": "y", "origin": [15, 12, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#5", "rotation": 90}, "east": {"uv": [0, 0, 8, 2], "texture": "#5", "rotation": 90}, "south": {"uv": [0, 0, 16, 16], "texture": "#5", "rotation": 270}, "west": {"uv": [0, 0, 2, 8], "texture": "#3"}, "up": {"uv": [0, 0, 2, 2], "texture": "#3"} } }, { "from": [2, 13, 7], "to": [3, 15, 9], "rotation": {"angle": 0, "axis": "y", "origin": [2.5, 14, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#5"}, "east": {"uv": [0, 0, 1, 2], "texture": "#3"}, "south": {"uv": [0, 0, 1, 2], "texture": "#3"}, "up": {"uv": [0, 0, 1, 2], "texture": "#3"}, "down": {"uv": [0, 0, 1, 2], "texture": "#3"} } }, { "from": [13, 13, 7], "to": [14, 15, 9], "rotation": {"angle": 0, "axis": "y", "origin": [13.5, 14, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#5"}, "south": {"uv": [0, 0, 16, 16], "texture": "#5"}, "west": {"uv": [0, 0, 2, 2], "texture": "#3"}, "up": {"uv": [0, 0, 1, 2], "texture": "#3"}, "down": {"uv": [0, 0, 1, 2], "texture": "#3"} } }, { "from": [3, 9, 7], "to": [13, 19, 9], "rotation": {"angle": 22.5, "axis": "x", "origin": [8, 14, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, "east": {"uv": [0, 0, 2, 10], "texture": "#3"}, "south": {"uv": [0, 0, 16, 16], "texture": "#4"}, "west": {"uv": [0, 0, 2, 10], "texture": "#3"}, "up": {"uv": [0, 0, 2, 10], "texture": "#3"}, "down": {"uv": [0, 0, 2, 10], "texture": "#3"} } }, { "from": [3, 0, 7], "to": [6, 1, 8], "faces": { "north": {"uv": [0, 0, 3, 1], "texture": "#1"}, "east": {"uv": [0, 0, 3, 1], "texture": "#1"}, "south": {"uv": [0, 0, 3, 1], "texture": "#1"}, "west": {"uv": [0, 0, 3, 1], "texture": "#1"}, "up": {"uv": [0, 0, 3, 1], "texture": "#1"}, "down": {"uv": [0, 0, 3, 1], "texture": "#1"} } }, { "from": [10, 0, 7], "to": [13, 1, 8], "faces": { "north": {"uv": [0, 0, 3, 1], "texture": "#1"}, "east": {"uv": [0, 0, 3, 1], "texture": "#1"}, "south": {"uv": [0, 0, 3, 1], "texture": "#1"}, "west": {"uv": [0, 0, 3, 1], "texture": "#1"}, "up": {"uv": [0, 0, 3, 1], "texture": "#1"}, "down": {"uv": [0, 0, 3, 1], "texture": "#1"} } }, { "from": [3, 1, 7], "to": [4, 3, 8], "faces": { "north": {"uv": [0, 0, 1, 2], "texture": "#1"}, "east": {"uv": [0, 0, 1, 2], "texture": "#1"}, "south": {"uv": [0, 0, 1, 2], "texture": "#1"}, "west": {"uv": [0, 0, 1, 2], "texture": "#1"}, "up": {"uv": [0, 0, 1, 2], "texture": "#1"} } }, { "from": [12, 1, 7], "to": [13, 3, 8], "faces": { "north": {"uv": [0, 0, 1, 2], "texture": "#1"}, "east": {"uv": [0, 0, 1, 2], "texture": "#1"}, "south": {"uv": [0, 0, 1, 2], "texture": "#1"}, "west": {"uv": [0, 0, 1, 2], "texture": "#1"}, "up": {"uv": [0, 0, 1, 2], "texture": "#1"} } }, { "from": [4, 2, 7], "to": [6, 3, 8], "faces": { "north": {"uv": [0, 0, 2, 1], "texture": "#1"}, "east": {"uv": [0, 0, 2, 1], "texture": "#1"}, "south": {"uv": [0, 0, 2, 1], "texture": "#1"}, "west": {"uv": [0, 0, 2, 1], "texture": "#1"}, "up": {"uv": [0, 0, 2, 1], "texture": "#1"}, "down": {"uv": [0, 0, 2, 1], "texture": "#1"} } }, { "from": [10, 2, 7], "to": [12, 3, 8], "faces": { "north": {"uv": [0, 0, 2, 1], "texture": "#1"}, "east": {"uv": [0, 0, 2, 1], "texture": "#1"}, "south": {"uv": [0, 0, 2, 1], "texture": "#1"}, "west": {"uv": [0, 0, 2, 1], "texture": "#1"}, "up": {"uv": [0, 0, 2, 1], "texture": "#1"}, "down": {"uv": [0, 0, 2, 1], "texture": "#1"} } }, { "from": [5, 3, 7], "to": [6, 5, 8], "faces": { "north": {"uv": [0, 0, 1, 2], "texture": "#1"}, "east": {"uv": [0, 0, 1, 2], "texture": "#1"}, "south": {"uv": [0, 0, 1, 2], "texture": "#1"}, "west": {"uv": [0, 0, 1, 2], "texture": "#1"}, "up": {"uv": [0, 0, 1, 2], "texture": "#1"} } }, { "from": [10, 3, 7], "to": [11, 5, 8], "faces": { "north": {"uv": [0, 0, 1, 2], "texture": "#1"}, "east": {"uv": [0, 0, 1, 2], "texture": "#1"}, "south": {"uv": [0, 0, 1, 2], "texture": "#1"}, "west": {"uv": [0, 0, 1, 2], "texture": "#1"}, "up": {"uv": [0, 0, 1, 2], "texture": "#1"} } }, { "from": [4, 4, 7], "to": [5, 5, 8], "faces": { "north": {"uv": [0, 0, 1, 1], "texture": "#1"}, "east": {"uv": [0, 0, 1, 1], "texture": "#1"}, "south": {"uv": [0, 0, 1, 1], "texture": "#1"}, "west": {"uv": [0, 0, 1, 1], "texture": "#1"}, "up": {"uv": [0, 0, 1, 1], "texture": "#1"}, "down": {"uv": [0, 0, 1, 1], "texture": "#1"} } }, { "from": [11, 4, 7], "to": [12, 5, 8], "faces": { "north": {"uv": [0, 0, 1, 1], "texture": "#1"}, "east": {"uv": [0, 0, 1, 1], "texture": "#1"}, "south": {"uv": [0, 0, 1, 1], "texture": "#1"}, "west": {"uv": [0, 0, 1, 1], "texture": "#1"}, "up": {"uv": [0, 0, 1, 1], "texture": "#1"}, "down": {"uv": [0, 0, 1, 1], "texture": "#1"} } } ], "display": { "thirdperson_righthand": { "scale": [0.5, 0.5, 0.5], "rotation": [0, 180, -30], "translation": [0, 0, 0] }, "thirdperson_lefthand": { "scale": [0.5, 0.5, 0.5], "rotation": [0, 180, -30] }, "firstperson_righthand": { "scale": [0.5, 0.5, 0.5], "rotation": [0, 180, 0] }, "firstperson_lefthand": { "scale": [0.5, 0.5, 0.5], "rotation": [0, 180, 0] }, "ground": { "scale": [0.5, 0.5, 0.5] }, "fixed": { "translation": [0, -1, -1] }, "gui": { "scale": [0.7, 0.7, 0.7], "rotation": [0, 180, 0], "translation": [0, -1, 0] } } } log: -
[Solved][1.12.2]How to get a model for a block
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
Thanks. Back to the Main Problem. it's still the missing texture texture -
[Solved][1.12.2]How to get a model for a block
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
@Override @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { return getDefaultState() .withProperty(BlockHorizontal.FACING, EnumFacing.getFront(meta & 5)); } @Override public int getMetaFromState(IBlockState blockState) { return blockState.getValue(BlockHorizontal.FACING).getIndex(); } More like this? Because this causes the game to crash after Pre Init. -
[Solved][1.12.2]How to get a model for a block
_Cruelar_ replied to _Cruelar_'s topic in Modder Support