Jump to content

MrProg

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by MrProg

  1. I'm having the same problem.
  2. Here is my enchanted_gem.json: { "parent": "builtin/generated", "textures": { "layer0": "vp:items/enchanted_gem" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } }
  3. Images of the issue: The top and side of this item is a bit weird, it looks like not all of the pixels are rendering in 3D. The code should be fine but here it is: public static void init(){ enchanted_gem = new ItemBasic().setUnlocalizedName("enchanted_gem"); enchanted_dust = new ItemEnchantedDust().setUnlocalizedName("enchanted_dust"); } public static void register(){ GameRegistry.registerItem(enchanted_gem, "enchanted_gem"); GameRegistry.registerItem(enchanted_dust, "enchanted_dust"); } public static void registerRenders(){ registerRender(enchanted_gem); registerRender(enchanted_dust); } public static void registerRender(Item item){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } The item in the pics is the enchanted_gem, while enchanted_dust works perfectly fine.
  4. So I'm trying to use the PlayerSleepInBedEvent but I want all of my code to execute somewhat while the player is in the middle of sleeping not as soon as the player right-clicks the bed. Is there a way to do this? Before I started using this event I used a PlayerTickEvent and just used the sleepTimer from the player of when to activate the event but I feel that the tick event may cause lag if it's always checking the if statement. Please correct me if I'm wrong but any help is appreciated
  5. Thanks! Forgot I had that. Also done! Thanks for the help.
  6. Alright so I have these achievements here: if(player.inventory.hasItem(Item.getItemFromBlock(WinterBlocks.icedStone))){ player.addStat(WinterAch.icedStone, 1); } if(player.inventory.hasItem(WinterItems.iceCrystal)){ player.addStat(WinterAch.iceCrystal, 1); } if(player.inventory.hasItem(WinterItems.iceIngot)){ player.addStat(WinterAch.iceIngot, 1); } So basically I have these all in a PlayerTickEvent which can lead onto some lag. At least logically. So I was wondering if there was a different place I could put these items with the same effect. These items are crafted in a custom furnace so using the pickup or crafting events won't be useful here.
  7. Yep, thanks.
  8. So Im trying to get an item array pick out a random item drop. But I've been testing and all I get is null. The metaList works because I get back 4 but for some reason my itemList only returns null. Here is the code for better understanding: public Item[] itemList = {WinterItems.crystalSword,WinterItems.refIcePickaxe,WinterItems.candyCaneAxe,WinterItems.commonItem}; public int[] metaList = {0,0,0,4}; public Item itemDropped; public int metaDropped; public BlockChristmasPresent(Material par2Material) { super(par2Material); this.itemDropped = itemList[3]; this.metaDropped = metaList[3]; } public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { par1World.playSoundAtEntity(par6EntityPlayer, "wintercraft:rip", 1F, 1F); System.out.println(itemList[0]); System.out.println(metaDropped); } Thanks for any help!
  9. Alright, thanks for looking at it.
  10. Oh yeah. Sorry I forgot all about that. Here it is: package wintercraft.items; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemRecord; import net.minecraft.util.ResourceLocation; import wintercraft.Wintercraft; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemChristmasMusicDisk extends ItemRecord{ public ItemChristmasMusicDisk(String recordName) { super(recordName); this.setCreativeTab(Wintercraft.WintercraftTab); this.maxStackSize = 1; } @Override public ResourceLocation getRecordResource(String name) { return new ResourceLocation(recordName); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(Wintercraft.modid + ":" + this.getUnlocalizedName().substring(5)); } }
  11. If I'm not mistaken, all that is required for adding sound in 1.7.10 is the sounds.json correct? Here it is anyway:
  12. Nope just tested with Optifine. It works on vanilla so it must be that.
  13. For some reason Optifine is conflicting with my mod and whenever I go to use a custom music disk it just doesn't play but the text will show up. Any ideas?
  14. That make sense, I had Optifine before and turned it higher than the default max. Thanks!
  15. I have nothing in the mods folder and only have Forge 10.13.2.1235 installed. Here's my crash report: Time: 11/9/14 1:34 PM Description: Unexpected error java.lang.IndexOutOfBoundsException at java.nio.Buffer.checkIndex(Unknown Source) at java.nio.DirectIntBufferU.get(Unknown Source) at net.minecraft.client.renderer.RenderGlobal.func_72712_a(RenderGlobal.java:350) at net.minecraft.client.renderer.RenderGlobal.func_72732_a(RenderGlobal.java:294) at net.minecraft.client.Minecraft.func_71353_a(Minecraft.java:2205) at net.minecraft.client.Minecraft.func_71403_a(Minecraft.java:2135) at net.minecraft.client.network.NetHandlerPlayClient.func_147282_a(NetHandlerPlayClient.java:239) at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:70) at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:13) at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2050) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:962) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:887) at net.minecraft.client.main.Main.main(SourceFile:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at java.nio.Buffer.checkIndex(Unknown Source) at java.nio.DirectIntBufferU.get(Unknown Source) at net.minecraft.client.renderer.RenderGlobal.func_72712_a(RenderGlobal.java:350) at net.minecraft.client.renderer.RenderGlobal.func_72732_a(RenderGlobal.java:294) at net.minecraft.client.Minecraft.func_71353_a(Minecraft.java:2205) at net.minecraft.client.Minecraft.func_71403_a(Minecraft.java:2135) at net.minecraft.client.network.NetHandlerPlayClient.func_147282_a(NetHandlerPlayClient.java:239) at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:70) at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:13) at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) -- Affected level -- Details: Level name: MpServer All players: 0 total; [] Chunk stats: MultiplayerChunkCache: 0, 0 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (8,64,, Chunk: (at 8,4,8 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 0 game time, 0 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 0 total; [] Retry entities: 0 total; [] Server brand: ~~ERROR~~ NullPointerException: null Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:373) at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2433) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:916) at net.minecraft.client.main.Main.main(SourceFile:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
  16. Sorry for such a long wait but I tried that and still have the same problem where the nose works fine but the ears still don't act correctly. Here is the changed code if needed: head = new ModelRenderer(this, 0, 53); head.addBox(-3F, -8F, -3F, 6, 6, 6); head.setRotationPoint(0F, 6F, 0F); head.setTextureSize(64, 128); head.mirror = true; setRotation(head, 0F, 0F, 0F); nose = new ModelRenderer(this, 50, 29); nose.addBox(-0.5F, -5F, -5F, 1, 1, 3); nose.setRotationPoint(0F, 6F, 0F); nose.setTextureSize(64, 128); nose.mirror = true; setRotation(nose, 0F, 0F, 0F); ear2 = new ModelRenderer(this, 56, 0); ear2.addBox(0.4F, -9F, -1.8F, 1, 4, 1); ear2.setRotationPoint(0F, 6F, 0F); ear2.setTextureSize(64, 128); ear2.mirror = true; setRotation(ear2, -0.3141593F, 0F, 0.2617994F); ear = new ModelRenderer(this, 56, 0); ear.addBox(-1.6F, -9.5F, -1.8F, 1, 4, 1); ear.setRotationPoint(0F, 6F, 0F); ear.setTextureSize(64, 128); ear.mirror = true; setRotation(ear, -0.3141593F, 0F, -0.2617994F);
  17. I do have the rotations points all the same. Here is the whole model class for any more reference: package wintercraft.render.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; public class ModelElf extends ModelBase { //fields ModelRenderer head; ModelRenderer nose; ModelRenderer ear; ModelRenderer ear2; ModelRenderer chest; ModelRenderer pants; ModelRenderer rightarm; ModelRenderer leftarm; ModelRenderer rightleg; ModelRenderer rightshoe; ModelRenderer leftleg; ModelRenderer leftshoe; ModelRenderer hatbrim; ModelRenderer hat1; ModelRenderer hat2; ModelRenderer hat3; ModelRenderer hat4; ModelRenderer hat5; ModelRenderer hat6; ModelRenderer hatpoof; public ModelElf() { textureWidth = 64; textureHeight = 128; head = new ModelRenderer(this, 0, 53); head.addBox(-4F, -8F, -4F, 6, 6, 6); head.setRotationPoint(1F, 6F, 0F); head.setTextureSize(64, 128); head.mirror = true; setRotation(head, 0F, 0F, 0F); nose = new ModelRenderer(this, 50, 29); nose.addBox(-1.5F, -5F, -6F, 1, 1, 3); nose.setRotationPoint(1F, 6F, 0F); nose.setTextureSize(64, 128); nose.mirror = true; setRotation(nose, 0F, 0F, 0F); ear2 = new ModelRenderer(this, 56, 0); ear2.addBox(-0.4F, -9F, -2.8F, 1, 4, 1); ear2.setRotationPoint(1F, 6F, 0F); ear2.setTextureSize(64, 128); ear2.mirror = true; setRotation(ear2, -0.3141593F, 0F, 0.2617994F); ear = new ModelRenderer(this, 56, 0); ear.addBox(-2.6F, -9.5F, -2.8F, 1, 4, 1); ear.setRotationPoint(1F, 6F, 0F); ear.setTextureSize(64, 128); ear.mirror = true; setRotation(ear, -0.3141593F, 0F, -0.2617994F); chest = new ModelRenderer(this, 19, 41); chest.addBox(0F, 0F, 0F, 7, 7, 4); chest.setRotationPoint(-3.5F, 4F, -2.5F); chest.setTextureSize(64, 128); chest.mirror = true; setRotation(chest, 0F, 0F, 0F); pants = new ModelRenderer(this, 15, 16); pants.addBox(-4F, 0F, -2F, 8, 5, 4); pants.setRotationPoint(0F, 11F, -0.5F); pants.setTextureSize(64, 128); pants.mirror = true; setRotation(pants, 0F, 0F, 0F); rightarm = new ModelRenderer(this, 40, 16); rightarm.addBox(-3F, -2F, -2F, 3, 9, 3); rightarm.setRotationPoint(-3.5F, 6F, 0F); rightarm.setTextureSize(64, 128); rightarm.mirror = true; setRotation(rightarm, 0F, 0F, 0.1396263F); leftarm = new ModelRenderer(this, 40, 16); leftarm.addBox(-1F, -2F, -2F, 3, 9, 3); leftarm.setRotationPoint(4.5F, 6F, 0F); leftarm.setTextureSize(64, 128); leftarm.mirror = true; setRotation(leftarm, 0F, 0F, -0.1396263F); rightleg = new ModelRenderer(this, 0, 16); rightleg.addBox(-2F, 0F, -2F, 3, 9, 3); rightleg.setRotationPoint(-1.7F, 15F, 0F); rightleg.setTextureSize(64, 128); rightleg.mirror = true; setRotation(rightleg, 0F, 0F, 0F); rightshoe = new ModelRenderer(this, 0, 29); rightshoe.addBox(-2.466667F, 6F, -4.4F, 4, 3, 6); rightshoe.setRotationPoint(2.7F, 15F, 0F); rightshoe.setTextureSize(64, 128); rightshoe.mirror = true; setRotation(rightshoe, 0F, 0F, 0F); leftleg = new ModelRenderer(this, 0, 16); leftleg.addBox(-2F, 0F, -2F, 3, 9, 3); leftleg.setRotationPoint(2.7F, 15F, 0F); leftleg.setTextureSize(64, 128); leftleg.mirror = true; setRotation(leftleg, 0F, 0F, 0F); leftshoe = new ModelRenderer(this, 0, 29); leftshoe.addBox(-7F, 6F, -4.4F, 4, 3, 6); leftshoe.setRotationPoint(2.7F, 15F, 0F); leftshoe.setTextureSize(64, 128); leftshoe.mirror = true; setRotation(leftshoe, 0F, 0F, 0F); hatbrim = new ModelRenderer(this, 25, 2); hatbrim.addBox(0F, 0F, 0F, 7, 1, ; hatbrim.setRotationPoint(-3.5F, -2.8F, -5F); hatbrim.setTextureSize(64, 128); hatbrim.mirror = true; setRotation(hatbrim, -0.122173F, 0F, 0F); hat1 = new ModelRenderer(this, 0, 0); hat1.addBox(0F, 0F, 0F, 6, 3, 6); hat1.setRotationPoint(-3F, -5F, -3.5F); hat1.setTextureSize(64, 128); hat1.mirror = true; setRotation(hat1, -0.1745329F, 0F, 0F); hat2 = new ModelRenderer(this, 0, 0); hat2.addBox(0F, 0F, 0F, 5, 3, 5); hat2.setRotationPoint(-2.5F, -6.8F, -2.1F); hat2.setTextureSize(64, 128); hat2.mirror = true; setRotation(hat2, -0.5410521F, 0F, 0F); hat3 = new ModelRenderer(this, 0, 0); hat3.addBox(0F, 0F, 0F, 4, 3, 4); hat3.setRotationPoint(-2F, -7.666667F, -0.5F); hat3.setTextureSize(64, 128); hat3.mirror = true; setRotation(hat3, -0.6981317F, 0F, 0F); hat4 = new ModelRenderer(this, 0, 0); hat4.addBox(0F, 0F, 0F, 3, 2, 3); hat4.setRotationPoint(-1.5F, -8.5F, 1.5F); hat4.setTextureSize(64, 128); hat4.mirror = true; setRotation(hat4, -0.9948377F, 0F, 0F); hat5 = new ModelRenderer(this, 0, 0); hat5.addBox(0F, 0F, 0F, 2, 3, 2); hat5.setRotationPoint(-1F, -9F, 3.4F); hat5.setTextureSize(64, 128); hat5.mirror = true; setRotation(hat5, -1.012291F, 0F, 0F); hat6 = new ModelRenderer(this, 0, 0); hat6.addBox(0F, 0F, 0F, 1, 2, 1); hat6.setRotationPoint(-0.5F, -9F, 5F); hat6.setTextureSize(64, 128); hat6.mirror = true; setRotation(hat6, -1.27409F, 0F, 0F); hatpoof = new ModelRenderer(this, 0, 39); hatpoof.addBox(0F, 0F, 0F, 2, 2, 2); hatpoof.setRotationPoint(-1F, -9.5F, 4.6F); hatpoof.setTextureSize(64, 128); hatpoof.mirror = true; setRotation(hatpoof, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5,entity); head.render(f5); nose.render(f5); ear.render(f5); ear2.render(f5); chest.render(f5); pants.render(f5); rightarm.render(f5); leftarm.render(f5); rightleg.render(f5); rightshoe.render(f5); leftleg.render(f5); leftshoe.render(f5); hatbrim.render(f5); hat1.render(f5); hat2.render(f5); hat3.render(f5); hat4.render(f5); hat5.render(f5); hat6.render(f5); hatpoof.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { this.head.rotateAngleX = f4 / (180F / (float)Math.PI); this.head.rotateAngleY = f3 / (180F / (float)Math.PI); this.nose.rotateAngleX = this.head.rotateAngleX; this.nose.rotateAngleY = this.head.rotateAngleY; this.ear.rotateAngleX = this.head.rotateAngleX; this.ear.rotateAngleY = this.head.rotateAngleY; this.ear2.rotateAngleX = this.head.rotateAngleX; this.ear2.rotateAngleY = this.head.rotateAngleY; this.leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5f; this.leftleg.rotateAngleY = 0.0f; this.rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4f * f1; this.rightleg.rotateAngleY = 0.0f; this.leftshoe.rotateAngleX = this.leftleg.rotateAngleX; this.leftshoe.rotateAngleY = this.leftleg.rotateAngleY; this.rightshoe.rotateAngleX = this.rightleg.rotateAngleX; this.rightshoe.rotateAngleY = this.rightleg.rotateAngleY; this.leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5f; this.leftarm.rotateAngleZ = 0.0f; this.rightarm.rotateAngleX = MathHelper.cos(f * 0.6663F + (float)Math.PI) * 1.4f * f1; this.rightarm.rotateAngleZ = 0.0f; } }
  18. So I have a mob, and when its head turns the ears don't go with it and instead kind of stay in place. The nose follows the head so I don't get why the ears don't. Here is the code for the rotation: public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { this.head.rotateAngleX = f4 / (180F / (float)Math.PI); this.head.rotateAngleY = f3 / (180F / (float)Math.PI); this.nose.rotateAngleX = this.head.rotateAngleX; this.nose.rotateAngleY = this.head.rotateAngleY; this.ear.rotateAngleX = this.head.rotateAngleX; this.ear.rotateAngleY = this.head.rotateAngleY; this.ear2.rotateAngleX = this.head.rotateAngleX; this.ear2.rotateAngleY = this.head.rotateAngleY; I also all have my model pieces in the same positions just with different offsets. Here's a normal picture when it's facing me: Here's a picture when it turns its head: Don't mind the hat I haven't tried fixing that yet.
  19. My title is too long to say solved but this has been solved! Here's a larger report Description: Ticking entity java.lang.RuntimeException: java.lang.NoSuchFieldException: sleepTimer at com.google.common.base.Throwables.propagate(Throwables.java:160) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:144) at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:220) at net.minecraft.client.entity.EntityClientPlayerMP.func_70071_h_(SourceFile:63) at net.minecraft.world.World.func_72866_a(World.java:2070) at net.minecraft.world.World.func_72870_g(World.java:2034) at net.minecraft.world.World.func_72939_s(World.java:1887) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1995) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:962) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:887) at net.minecraft.client.main.Main.main(SourceFile:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.NoSuchFieldException: sleepTimer at java.lang.Class.getDeclaredField(Unknown Source) at wintercraft.helper.PlayerTickHandler.serverTick(PlayerTickHandler.java:33) at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_PlayerTickHandler_serverTick_PlayerTickEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) ... 16 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.google.common.base.Throwables.propagate(Throwables.java:160) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:144) at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:220) at net.minecraft.client.entity.EntityClientPlayerMP.func_70071_h_(SourceFile:63) at net.minecraft.world.World.func_72866_a(World.java:2070) at net.minecraft.world.World.func_72870_g(World.java:2034) -- Entity being ticked -- Details: Entity Type: null (net.minecraft.client.entity.EntityClientPlayerMP) Entity ID: 156 Entity Name: gruntpie224 Entity's Exact location: 8.50, 66.62, 8.50 Entity's Block location: World: (8,66,, Chunk: (at 8,4,8 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0.00, 0.00, 0.00 Stacktrace: at net.minecraft.world.World.func_72939_s(World.java:1887) My mod works when it runs from eclipse just not when I use the gradlew build and then use the jar it puts out. The game starts up fine but when I try to create a new world I get that error. It may have something to do with this, more than likely, but I don't get why it works in eclipse: @SubscribeEvent public void serverTick(PlayerTickEvent event) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{ EntityPlayer player = event.player; Random generator = new Random(); Field f = EntityPlayer.class.getDeclaredField("sleepTimer"); f.setAccessible(true);//Very important, this allows the setting to work. int sleepTimer = (Integer) f.get(player); /////not relevant code///// }
  20. Nevermind, I found a solution. I just replaced the par6Player.dropItem with setting the getItemDropped to the item needed.
  21. I used onBlockHarvest instead as it had the EntityPlayer and this is what I came up with: @Override public void onBlockHarvested(World par1World, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer par6Player) { if(par6Player.getCurrentEquippedItem() != null){ if(par6Player.getCurrentEquippedItem().getItem() == WinterItems.candyCaneAxe){ par6Player.dropItem(Item.getItemFromBlock(WinterBlocks.candyCaneBlock), 1); }else{ par6Player.dropItem(WinterItems.candyCane, 3); } }else{ par6Player.dropItem(WinterItems.candyCane, 3); } } The only problem is that the item flies out of the player which is kind of weird. Is there another similar way that I could do this that has the item drop from the block?
  22. So basically I have a block that I want to drop itself when it's broken with a certain item but drop something else when broken with anything else. My situation is having a candy cane log to drop itself when broken with a candy cane axe. Anything else will have it drop candy canes. Thank you for any help that can be provided.
  23. Alright, thanks!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.