Jump to content

Exp

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Exp

  1. Hey,

    so I started coding but now I want to make like a custom fire that acts like the normal fire (not the block, but rather the one you set with entity.setFire()), but has like special things like it won't be affected by water or rain...But I don't have any idea...Should I make a potion effect? If yes how can i render the fire on the entity?

    Hope someone knows a way around this^^

  2. Hello,

    I've written my mod now that it works on Servers too (added proxies and such), but now I get an error everytime I try to call a method with Keyboard.isKeyDown() saying I need to create a keyboard before querying key states.

    Weird enough it works in my AddInformation method.

    Here's the error:

     

    [server thread/FATAL]: Error executing task

    java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.opengl.Display

    at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_73]

    at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_73]

    at net.minecraft.util.Util.runTask(Util.java:24) [util.class:?]

    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:738) [MinecraftServer.class:?]

    at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:407) [DedicatedServer.class:?]

    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683) [MinecraftServer.class:?]

    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532) [MinecraftServer.class:?]

    at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]

    Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.opengl.Display

    at com.exp.testmod.items.itemTotemTool.onItemUse(itemTotemTool.java:65) ~[itemTotemTool.class:?]

    at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:724) ~[ForgeHooks.class:?]

    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:155) ~[itemStack.class:?]

    at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:484) ~[PlayerInteractionManager.class:?]

    at net.minecraft.network.NetHandlerPlayServer.processRightClickBlock(NetHandlerPlayServer.java:706) ~[NetHandlerPlayServer.class:?]

    at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:68) ~[CPacketPlayerTryUseItem.class:?]

    at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:13) ~[CPacketPlayerTryUseItem.class:?]

    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]

    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_73]

    at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_73]

    at net.minecraft.util.Util.runTask(Util.java:23) ~[util.class:?]

    ... 5 more

    [19:50:47] [server thread/FATAL]: Error executing task

    java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Keyboard must be created before you can query key state

    at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_73]

    at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_73]

    at net.minecraft.util.Util.runTask(Util.java:24) [util.class:?]

    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:738) [MinecraftServer.class:?]

    at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:407) [DedicatedServer.class:?]

    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683) [MinecraftServer.class:?]

    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532) [MinecraftServer.class:?]

    at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]

    Caused by: java.lang.IllegalStateException: Keyboard must be created before you can query key state

    at org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:406) ~[lwjgl-2.9.4-nightly-20150209.jar:?]

    at com.exp.testmod.items.itemTotemTool.onItemRightClick(itemTotemTool.java:91) ~[itemTotemTool.class:?]

    at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:173) ~[itemStack.class:?]

    at net.minecraft.server.management.PlayerInteractionManager.processRightClick(PlayerInteractionManager.java:382) ~[PlayerInteractionManager.class:?]

    at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:742) ~[NetHandlerPlayServer.class:?]

    at net.minecraft.network.play.client.CPacketPlayerBlockPlacement.processPacket(CPacketPlayerBlockPlacement.java:43) ~[CPacketPlayerBlockPlacement.class:?]

    at net.minecraft.network.play.client.CPacketPlayerBlockPlacement.processPacket(CPacketPlayerBlockPlacement.java:9) ~[CPacketPlayerBlockPlacement.class:?]

    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]

    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_73]

    at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_73]

    at net.minecraft.util.Util.runTask(Util.java:23) ~[util.class:?]

    ... 5 more

     

     

    And here is the source:

    package com.exp.testmod.items;

     

    import java.util.List;

    import java.util.Random;

     

    import org.lwjgl.LWJGLException;

    import org.lwjgl.input.Keyboard;

    import org.lwjgl.opengl.Display;

     

    import com.exp.testmod.TestMod;

     

    import net.minecraft.block.Block;

    import net.minecraft.client.audio.PositionedSound;

    import net.minecraft.creativetab.CreativeTabs;

    import net.minecraft.entity.EntityLivingBase;

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.init.Blocks;

    import net.minecraft.init.SoundEvents;

    import net.minecraft.item.Item;

    import net.minecraft.item.ItemStack;

    import net.minecraft.util.ActionResult;

    import net.minecraft.util.EnumActionResult;

    import net.minecraft.util.EnumFacing;

    import net.minecraft.util.EnumHand;

    import net.minecraft.util.math.BlockPos;

    import net.minecraft.world.World;

     

    public class itemTotemTool extends Item {

     

    private String setInfo;

    private String[] ColorList = {"\u00a70","\u00a71","\u00a72","\u00a73","\u00a74","\u00a75","\u00a76","\u00a77","\u00a78","\u00a79","\u00a7a","\u00a7b","\u00a7c","\u00a7d","\u00a7e","\u00a7f"};

     

    public itemTotemTool() {

    this.setUnlocalizedName("totem_tool");

    this.setCreativeTab(TestMod.tabCustomTab);

    this.setMaxDamage(5);

    this.setMaxStackSize(1);

    this.setInfo="Magic OP Tool";

    this.setNoRepair();

     

    }

     

    @Override

    public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {

    if(Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)) {

    tooltip.add(getColor()+"§o"+this.setInfo);

    }

    super.addInformation(stack, playerIn, tooltip, advanced);

    }

     

    private String getColor() {

    int i;

    if (TestMod.rainbowtooltipsdisabled==false) {

    Random random = new Random();

    i = random.nextInt(16);

    } else {

    i = 7;

    }

    return ColorList;

    }

     

    @Override

    public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,

    EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

    if(Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)) {

    checkBlockAoe(worldIn,playerIn,stack);

    } else {

    checkBlock(pos,worldIn,playerIn,stack, 0);

    }

    return super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);

    }

     

    @Override

    public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn,

    EnumHand hand) {

    if(Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)) {

    checkBlockAoe(worldIn,playerIn,itemStackIn);

    }

    return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand);

    }

     

    private void checkBlockAoe(World worldIn, EntityPlayer playerIn, ItemStack stack) {

    BlockPos ppos = playerIn.getPosition();

    BlockPos StartPos = new BlockPos(ppos.getX()-1,ppos.getY()-1,ppos.getZ()-1);

    for (int i=0;i<3;i++) { //x

    for (int j=0;j<3;j++) { //z

    checkBlock(new BlockPos(StartPos.getX()+i,StartPos.getY(),StartPos.getZ()+j), worldIn, playerIn, stack, 1);

    }

    }

    }

     

    private void checkBlock(BlockPos pos, World worldIn, EntityPlayer playerIn, ItemStack stack, int aoe) {

    if (worldIn.getBlockState(pos).getBlock()==Blocks.iron_ore) {

    swapBlock(pos,worldIn,Blocks.iron_block,playerIn,stack, aoe);

    } else if (worldIn.getBlockState(pos).getBlock()==Blocks.diamond_ore){

    swapBlock(pos,worldIn,Blocks.diamond_block,playerIn,stack, aoe);

    } else if (worldIn.getBlockState(pos).getBlock()==Blocks.diamond_ore){

    swapBlock(pos,worldIn,Blocks.diamond_block,playerIn,stack, aoe);

    } else if (worldIn.getBlockState(pos).getBlock()==Blocks.coal_ore){

    swapBlock(pos,worldIn,Blocks.coal_block,playerIn,stack, aoe);

    } else if (worldIn.getBlockState(pos).getBlock()==Blocks.gold_ore){

    swapBlock(pos,worldIn,Blocks.gold_block,playerIn,stack, aoe);

    } else if (worldIn.getBlockState(pos).getBlock()==Blocks.lapis_ore){

    swapBlock(pos,worldIn,Blocks.lapis_block,playerIn,stack, aoe);

    } else if (worldIn.getBlockState(pos).getBlock()==Blocks.emerald_ore){

    swapBlock(pos,worldIn,Blocks.emerald_block,playerIn,stack, aoe);

    } else if (worldIn.getBlockState(pos).getBlock()==Blocks.quartz_ore){

    swapBlock(pos,worldIn,Blocks.quartz_block,playerIn,stack, aoe);

    }

    }

     

    private void swapBlock(BlockPos pos, World world, Block newblock,EntityPlayer player,ItemStack stack, int aoe) {

    player.playSound(SoundEvents.entity_experience_orb_pickup, 1, 1);

    world.destroyBlock(pos, false);

    world.setBlockState(pos, newblock.getDefaultState());

    if (!player.isCreative()) {

    if (aoe==0) {

    stack.damageItem(1, player);

    } else {

    stack.damageItem((stack.getMaxDamage()-stack.getItemDamage())+1, player);

    }

    }

    }

    }

     

     

     

    Anybody knows a solution to this? Tried already using Keyboard.create() and Display.create() but it still won't work...

     

  3. So I've started making a mod in Minecraft...

    Now I want to add my items to dungeon loot tables. As ChestGenHooks are removed is there any other easy way? I've seen DrCyano's AdditionalLootTables, but is there a way of few lines as I don't want to rely on other mods.

    Is there an easy way to read out the dungeon loot tables too like getting a random item out of the whole pool...

    Would be nice to see a respond here^^

×
×
  • Create New...

Important Information

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