Jump to content

ryancpexpert

Forge Modder
  • Posts

    58
  • Joined

  • Last visited

Posts posted by ryancpexpert

  1. I am aware of the debug mode in eclipse, however, I cannot use it for some reason (fails to start the client everytime).

     

    I have just checked over myself, and it appears I had not registered my EventHandler. Should be resgistered now.

     

    To answer your last question Ernio, I believe I am using the correct bus,

    MinecraftForge.EVENT_BUS.register(new MIEventHandler());
    

     

  2. I've already registered the EventHandler @charsmud,

     

    I made a few changes to it, and now it fails to start (previously it would start).

     

    [18:25:21] [main/INFO] [FML/]: Forge Mod Loader version 7.10.18.1180 for Minecraft 1.7.10 loading
    [18:25:21] [main/INFO] [FML/]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_25, running on Windows 8.1:amd64:6.3, installed at C:\Program Files (x86)\Minecraft\runtime\jre-x64\1.8.0_25
    [18:25:21] [main/DEBUG] [FML/]: Java classpath at launch is C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\net\minecraftforge\forge\1.7.10-10.13.0.1180\forge-1.7.10-10.13.0.1180.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\net\minecraft\launchwrapper\1.9\launchwrapper-1.9.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\ow2\asm\asm-all\4.1\asm-all-4.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\typesafe\akka\akka-actor_2.11\2.3.3\akka-actor_2.11-2.3.3.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\typesafe\config\1.2.1\config-1.2.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\scala-actors-migration_2.11\1.1.0\scala-actors-migration_2.11-1.1.0.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\scala-compiler\2.11.1\scala-compiler-2.11.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\plugins\scala-continuations-library_2.11\1.0.2\scala-continuations-library_2.11-1.0.2.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\plugins\scala-continuations-plugin_2.11.1\1.0.2\scala-continuations-plugin_2.11.1-1.0.2.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\scala-library\2.11.1\scala-library-2.11.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\scala-parser-combinators_2.11\1.0.1\scala-parser-combinators_2.11-1.0.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\scala-reflect\2.11.1\scala-reflect-2.11.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\scala-swing_2.11\1.0.1\scala-swing_2.11-1.0.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\scala-lang\scala-xml_2.11\1.0.2\scala-xml_2.11-1.0.2.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.5\jopt-simple-4.5.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\lzma\lzma\0.0.1\lzma-0.0.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\mojang\realms\1.3.1\realms-1.3.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-compress\1.8.1\commons-compress-1.8.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\java3d\vecmath\1.3.1\vecmath-1.3.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\io\netty\netty-all\4.0.10.Final\netty-all-4.0.10.Final.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\16.0\guava-16.0.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.2.1\commons-lang3-3.2.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\com\mojang\authlib\1.5.16\authlib-1.5.16.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.1\lwjgl-2.9.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.1\lwjgl_util-2.9.1.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch\5.16\twitch-5.16.jar;C:\Users\Ryan\AppData\Roaming\.minecraft\versions\1.7.10-Forge10.13.0.1180\1.7.10-Forge10.13.0.1180.jar
    [18:25:21] [main/DEBUG] [FML/]: Java library path at launch is C:\Users\Ryan\AppData\Roaming\.minecraft\versions\1.7.10-Forge10.13.0.1180\1.7.10-Forge10.13.0.1180-natives-441561050886975
    [18:25:21] [main/DEBUG] [FML/]: Enabling runtime deobfuscation
    [18:25:21] [main/DEBUG] [FML/]: Instantiating coremod class FMLCorePlugin
    [18:25:21] [main/DEBUG] [FML/]: Added access transformer class cpw.mods.fml.common.asm.transformers.AccessTransformer to enqueued access transformers
    [18:25:21] [main/DEBUG] [FML/]: Enqueued coremod FMLCorePlugin
    [18:25:21] [main/DEBUG] [FML/]: Instantiating coremod class FMLForgePlugin
    [18:25:21] [main/DEBUG] [FML/]: Added access transformer class net.minecraftforge.transformers.ForgeAccessTransformer to enqueued access transformers
    [18:25:21] [main/DEBUG] [FML/]: Enqueued coremod FMLForgePlugin
    [18:25:21] [main/DEBUG] [FML/]: All fundamental core mods are successfully located
    [18:25:21] [main/DEBUG] [FML/]: Discovering coremods
    [18:25:21] [main/DEBUG] [FML/]: Examining for coremod candidacy FNAF-1.7.10-0.0.1.jar
    [18:25:21] [main/DEBUG] [FML/]: Not found coremod data in FNAF-1.7.10-0.0.1.jar
    [18:25:21] [main/INFO] [LaunchWrapper/]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
    [18:25:21] [main/INFO] [LaunchWrapper/]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
    [18:25:21] [main/INFO] [LaunchWrapper/]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
    [18:25:21] [main/ERROR] [LaunchWrapper/]: Unable to launch
    java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) ~[?:1.8.0_25]
    at java.util.ArrayList$Itr.remove(ArrayList.java:865) ~[?:1.8.0_25]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:117) [launchwrapper-1.9.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
    

     

    public class MIEventHandler {
    
    @SubscribeEvent
    public void onInterect(PlayerInteractEvent e) {
    	//Following lines of code control creation of chiseled ruby/sapphire using chisel.
    	EntityPlayer player = e.entityPlayer;
    	ItemStack itemstack = player.getHeldItem();
    	World world = e.world;
    	int x = e.x;
    	int y = e.y;
    	int z = e.z;
    		if(e.action == e.action.RIGHT_CLICK_BLOCK){
    			player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.AQUA + "Right click block check working."));
    			if(!world.isRemote){
    				player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.AQUA + "Side check working."));
    				if(itemstack == new ItemStack(MIMain.chisel)) {
    					player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.AQUA + "Chisel check working."));
    					if(world.getBlock(x, y, z) != null) {
    						if(world.getBlock(x, y, z) == MIMain.rubyBlock) {
    							player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.AQUA + "Ruby block check working."));
    							world.setBlock(x, y, z, MIMain.chiseledRuby);
    							if(!player.capabilities.isCreativeMode) {
    								itemstack.setItemDamage(itemstack.getItemDamage() - 1);
    					}
    				}	else if(world.getBlock(x, y, z) == MIMain.sapphireBlock) {
    					player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.AQUA + "Sapphire block check working."));
    						world.setBlock(x, y, z, MIMain.chiseledSapphire);
    						if(!player.capabilities.isCreativeMode) {
    							itemstack.setItemDamage(itemstack.getItemDamage() - 1);
    					}
    				}
    			}
    		}
    

  3. Excuse this mess,

    public class MIEventHandler {
    
    @SubscribeEvent
    public void onInterect(PlayerInteractEvent e) {
    	//Following lines of code control creation of chiseled ruby/sapphire using chisel.
    	EntityPlayer player = e.entityPlayer;
    	ItemStack itemstack = player.getHeldItem();
    	World world = e.world;
    	int x = e.x;
    	int y = e.y;
    	int z = e.z;
    		if(e.action == e.action.RIGHT_CLICK_BLOCK){
    			if(itemstack == new ItemStack(MIMain.chisel)) {
    				if(world.getBlock(x, y, z) != null) {
    					if(world.getBlock(x, y, z) == MIMain.rubyBlock) {
    						world.setBlock(x, y, z, MIMain.chiseledRuby);
    						if(!player.capabilities.isCreativeMode) {
    							itemstack.setItemDamage(itemstack.getItemDamage() - 1);
    					}
    				}	else if(world.getBlock(x, y, z) == MIMain.sapphireBlock) {
    						world.setBlock(x, y, z, MIMain.chiseledSapphire);
    						if(!player.capabilities.isCreativeMode) {
    							itemstack.setItemDamage(itemstack.getItemDamage() - 1);
    					}
    				}
    			}
    		}
    

    I'm trying to test whether the player has a chisel in their hand, and if they do, then it will check whether they have clicked a sapphire block or ruby block, and if it is, set it to a chiseled version of the block, however, it appears not to be working. Could anyone help me out here?

  4. It still isn't attacking me, updated code:

     

     

     

    public class EntityFreddyMob extends EntityMob{

     

    public EntityFreddyMob(World world) {

    super(world);

    this.setSize(1.0F, 2.0F);

    this.tasks.addTask(0, new EntityAIWander(this, 0.5));

    this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));

     

    }

    @Override

    public boolean isAIEnabled() {

    return true;

    }

    @Override

    protected void applyEntityAttributes() {

    super.applyEntityAttributes();

    this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5F);

    this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(20.0F);

    }

    @Override

        public boolean attackEntityFrom(DamageSource damageSource, float p_70097_2_)

        {

        return false;

        }

     

    }

     

     

    I removed the float, as it was giving me an error.

     

    EDIT - NVM! Realized that I needed both tasks, problem solved.

  5. I have created a new entity mob, and gave it the Attack Entity task. I then added more tasks and things, and it seems to have broken it.

     

     

     

    public class EntityFreddyMob extends EntityMob{

     

    public EntityFreddyMob(World world) {

    super(world);

    this.setSize(1.0F, 2.0F);

    this.tasks.addTask(0, new EntityAIWander(this, 0.5));

    this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));

     

    }

     

    public boolean isAIEnabled() {

    return true;

    }

     

    protected void applyEntityAttributes() {

    super.applyEntityAttributes();

    this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5F);

    this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(20.0F);

    }

    @Override

        public boolean attackEntityFrom(DamageSource damageSource, float p_70097_2_)

        {

        return false;

        }

     

     

    Any help is appreciated.

  6.  

     

    package me.ryancp.zeldamod.containers;
    
    import java.lang.ref.WeakReference;
    import java.util.ArrayList;
    
    import me.ryancp.zeldamod.ZeldaMod;
    import me.ryancp.zeldamod.api.IZelda;
    import me.ryancp.zeldamod.api.ZeldaType;
    import me.ryancp.zeldamod.packets.PacketHandler;
    import me.ryancp.zeldamod.packets.PacketSyncZelda;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.nbt.NBTTagList;
    import net.minecraft.util.MathHelper;
    
    public class InventoryZelda implements IInventory {
    public ItemStack[] stackList;
    private Container eventHandler;
    public WeakReference<EntityPlayer> player;
    public boolean blockEvents=false;
    
    public InventoryZelda(EntityPlayer player) {
    	this.stackList = new ItemStack[1];
    	this.player = new WeakReference<EntityPlayer>(player);
    }
    
    public Container getEventHandler() {
    	return eventHandler;
    }
    
    public void setEventHandler(Container eventHandler) {
    	this.eventHandler = eventHandler;
    }
    
    @Override
    public int getSizeInventory() {
    	return this.stackList.length;
    }
    
    @Override
    public ItemStack getStackInSlot(int par1) {
    	return par1 >= this.getSizeInventory() ? null : this.stackList[par1];
    }
    
    @Override
    public String getInventoryName() {
    	return "";
    }
    
    @Override
    public boolean hasCustomInventoryName() {
    	return false;
    }
    
    @Override
    public ItemStack getStackInSlotOnClosing(int par1) {
    	if (this.stackList[par1] != null) {
    		ItemStack itemstack = this.stackList[par1];
    		this.stackList[par1] = null;
    		return itemstack;
    	}
    	else {
    		return null;
    	}
    
    	}
    @Override
    public ItemStack decrStackSize(int par1, int par2) {
    	if (this.stackList[par1] != null) {
    		ItemStack itemstack;
    
    		if (this.stackList[par1].stackSize <= par2) {
    			itemstack = this.stackList[par1];
    
    			if (itemstack != null && itemstack.getItem() instanceof IZelda) {
    				((IZelda) itemstack.getItem()).onUnequipped(itemstack, player.get());
    			}
    
    			this.stackList[par1] = null;
    
    			if (eventHandler != null) {
    				this.eventHandler.onCraftMatrixChanged(this);
    				syncSlotToClients(par1);
    				return itemstack;
    			}
    		}
    		itemstack = this.stackList[par1].splitStack(par2);
    
    		if (itemstack != null && itemstack.getItem() instanceof IZelda) {
    			((IZelda) itemstack.getItem()).onUnequipped(itemstack,
    					player.get());
    		}
    
    		if (this.stackList[par1].stackSize == 0) {
    			this.stackList[par1] = null;
    		}
    
    		if (eventHandler != null)
    			this.eventHandler.onCraftMatrixChanged(this);
    		syncSlotToClients(par1);
    		return itemstack;
    	} else {
    		return null;
    	}
    
    }
    
    private void syncSlotToClients(int slot) {
    	try {
    		if (ZeldaMod.proxy.getClientWorld() == null) {
    			PacketHandler.INSTANCE.sendToAll(new PacketSyncZelda(player.get(), slot));
    		}
    	}
    	catch (Exception e) {
    		e.printStackTrace();
    	}
    
    }
    
    @Override
    public void setInventorySlotContents(int par1, ItemStack stack) {
    
    	if(!blockEvents && this.stackList[par1] != null) {
    		((IZelda)stackList[par1].getItem()).onUnequipped(stackList[par1], player.get());
    	}
    	this.stackList[par1] = stack;
    	if (!blockEvents && stack != null && stack.getItem() instanceof IZelda) {
    		((IZelda) stack.getItem()).onEquipped(stack, player.get());
    	}
    	if (eventHandler != null) 
    		this.eventHandler.onCraftMatrixChanged(this);
    	syncSlotToClients(par1);
    }
    
    @Override
    public int getInventoryStackLimit() {
    	return 1;
    }
    
    @Override
    public void markDirty() {
    	try {
    		player.get().inventory.markDirty();
    	} catch (Exception e) {
    	}
    }
    
    @Override
    public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) {
    	return true;
    }
    
    @Override
    public void openInventory() {
    
    
    }
    
    @Override
    public void closeInventory() {
    
    
    }
    
    public void saveNBT(EntityPlayer player) {
    	NBTTagCompound tags = player.getEntityData();
    	saveNBT(tags);
    }
    
    public void saveNBT(NBTTagCompound tags) {
    	NBTTagList tagList = new NBTTagList();
    	NBTTagCompound invSlot;
    	for (int i = 0; i < this.stackList.length; ++i) {
    		if (this.stackList[i] != null) {
    			invSlot = new NBTTagCompound();
    			invSlot.setByte("Slot", (byte) i);
    			this.stackList[i].writeToNBT(invSlot);
    			tagList.appendTag(invSlot);
    		}
    	}
    	tags.setTag("Zelda.Inventory", tagList);
    }
    
    public void readNBT(EntityPlayer player) {
    	NBTTagCompound tags = player.getEntityData();
    	readNBT(tags);
    }
    
    public void readNBT(NBTTagCompound tags) {
    	NBTTagList tagList = tags.getTagList("Zelda.Inventory", 10);
    	for (int i = 0; i < tagList.tagCount(); ++i) {
    		NBTTagCompound nbttagcompound = (NBTTagCompound) tagList
    				.getCompoundTagAt(i);
    		int j = nbttagcompound.getByte("Slot") & 255;
    		ItemStack itemstack = ItemStack
    				.loadItemStackFromNBT(nbttagcompound);
    		if (itemstack != null) {
    			this.stackList[j] = itemstack;
    		}
    	}
    }
    
    @Override
    public boolean isItemValidForSlot(int i, ItemStack stack) {
    	if (stack == null || !(stack.getItem() instanceof IZelda || !((IZelda) stack.getItem()).canEquip(stack, player.get())))
    		return false;
    	if (i == 0 && ((IZelda) stack.getItem()).getZeldaType(stack) == ZeldaType.SHIELD)
    		return true;
    	if (i == 0 && ((IZelda) stack.getItem()).getZeldaType(stack) == ZeldaType.BOOT) {
    		return true;
    	}
    	return false;
    }
    }
    

     

     

    I believe this is the only other place I'm sending packets.

  7. this what you mean?

    package me.ryancp.zeldamod;
    
    import org.lwjgl.input.Keyboard;
    
    import cpw.mods.fml.client.FMLClientHandler;
    import cpw.mods.fml.client.registry.ClientRegistry;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import cpw.mods.fml.common.gameevent.TickEvent.Phase;
    import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import me.ryancp.zeldamod.packets.PacketHandler;
    import me.ryancp.zeldamod.packets.PacketOpenZeldaInventory;
    import net.minecraft.client.settings.KeyBinding;
    
    public class KeyHandler {
    
    public KeyBinding key = new KeyBinding("Zelda Inventory", 
    		Keyboard.KEY_Z, "key.categories.inventory");
    
    public KeyHandler() {
    	 ClientRegistry.registerKeyBinding(key);
    }
    
    @SideOnly(value=Side.CLIENT)
    @SubscribeEvent
    public void playerTick(PlayerTickEvent event) {
    	if (event.side == Side.SERVER) return;
    	if (event.phase == Phase.START ) {
    		if (key.getIsKeyPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) {
    				PacketHandler.INSTANCE.sendToServer(new PacketOpenZeldaInventory(event.player));
    		}
    	}
    }
    }
    

     

  8. I am working on a Zelda mod, and I am trying to add a item that will allow the player to create a block using it. I am currently using entities to determine where it should place the block, however, I am trying to make it not depend on the entity, and only on the item, as I only want the player to be able to spawn the block 1 block in front of them. How would I go about testing which way the player is facing so I can determine how to set the block in the code?

  9. There are multiple instances inside my mod where I need to add a score to track whether the player should be given a item, or if the player can use the item. I know I can declare a integer and use that, however, I want this to be able to function on multi player, and only set it for the player. Any help is appreciated.

×
×
  • Create New...

Important Information

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