I'm sorry if I didn't make it clear in the first post, but the probem has nothing to do with the entity ID, it has to do with getSpawnerLogic(). According to eclipse, getSpawnerLogic doesn't exist.
I have included some pictures. As you can see if shows that getSpawnerogic is throwing an error because it's undefined:
Trying to let the IDE fix the error doesn't help. The two fixes for this are pretty much useless.
Here is another image to show the autocomplete dropdown list that eclipse shows. No getSpawnerLogic() is shown.
Any thoughts on what could be causing this? I've made no edits to the original TileEntityMobSpawner class (I can't even find it to look at it if I wanted to help myself)
EDIT: Also, for what it's worth, I'm not using it to spawn a custom entity. It's just for existing mobs.
I'm making a structure that generates with a mob spawner in it, and I can't figure out how to set which mob spawns from it. All I see everybody use is .getSpawnLogic() and when I try to access it, it says that it doesn't exist. Here is my code for declaring the spawner so far:
I have the block and I set it to be a TileEntitySpawner, but when trying to do
spawn.getSpawnerLogic().setMobID(EntityHere);
I get an error on getSpawnerLogic because it can't find it. I can't find a similar replacement function either. I don't know if the method doesn't exist or if I'm actually missing something. I couldn't find an answer to this question on the forums after a quick search. Any fixes?
I'm trying to make an Avatar: The Last Airbender style of mod where, after getting certain armor sets, your player can bend the elements, and I can't get most of these things to work right.
I'm positive it's something basic, but it's been stumping me for days and I can't find anything online that'll help (it's probably just that simple really)
First things first, here's the code for my ticker class. It's registered in a client proxy already as well.
import java.util.EnumSet;
import java.util.List;
import org.lwjgl.input.Keyboard;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class JoeTicker implements ITickHandler
{
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
}
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
if(type.equals(EnumSet.of(TickType.CLIENT)))
{
Minecraft mc = Minecraft.getMinecraft();
GuiScreen curScreen = Minecraft.getMinecraft().currentScreen;
if(curScreen != null)
{
onTickInGui(mc, curScreen);
}
else onTickInGame(mc);
}
}
private void onTickInGame(Minecraft minecraft)
{
EntityPlayer p = FMLClientHandler.instance().getClient().thePlayer;
ItemStack boots = p.inventory.armorInventory[0];
ItemStack legs = p.inventory.armorInventory[1];
ItemStack chest = p.inventory.armorInventory[2];
ItemStack helm = p.inventory.armorInventory[3];
if(boots == null && legs == null && chest == null && helm == null)
{
return;
}
if(boots != null && legs != null && chest != null && helm != null)
{
if (boots.itemID == BaseModJoe.bronzeBoots.shiftedIndex && legs.itemID == BaseModJoe.bronzeLeggings.shiftedIndex && chest.itemID == BaseModJoe.bronzeChestplate.shiftedIndex && helm.itemID == BaseModJoe.bronzeHelmet.shiftedIndex)
{
if (Keyboard.isKeyDown(minecraft.gameSettings.keyBindJump.keyCode))
{
p.motionY += 0.067999999105930325D; //Change this value to how high you wnat the player to jump
p.speedInAir = 0.0334999996F; //Change this value to set the speed while in air
if (p.motionY < 0)
{
p.motionY += -p.motionY / 10;
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_M))
{
for (int x = -2; x <= 2; x++)
{
for (int y = -2; y <= 2; y++)
{
for (int z = -2; z <= 2; z++)
{
int block = minecraft.theWorld.getBlockId((int)p.posX + x, (int)p.posY + y, (int)p.posZ + z);
if (block == Block.waterStill.blockID || block == Block.waterMoving.blockID)
{
minecraft.theWorld.setBlockWithNotify((int)p.posX + x, (int)p.posY + y, (int)p.posZ + z, 0);
}
}
}
}
}
}
minecraft.thePlayer.fallDistance = 0.0F;
}
}
}
}
private void onTickInGui(Minecraft minecraft, GuiScreen gui)
{
}
@Override
public EnumSet<TickType> ticks() {
// TODO Auto-generated method stub
return EnumSet.of(TickType.CLIENT, TickType.RENDER);
}
@Override
public String getLabel() {
// TODO Auto-generated method stub
return "TickHandler.CLIENT";
}
}
What the code is supposed to do is allow the player to jump higher and, when the player holds down the M key, any water around him will turn into air, which means that the player can make an air bubble around them when they're underwater.
To start, the code works in that the water around the player WILL turn into air. However, the water around the new air bubble doesnt fall back into place when the player releases the button, meaning that the bubble will stay permanent and won't collapse on itself. This makes for something odd looking tunnels through the water.
Also, when a block is placed inside the new bubble, water will spawn around it, as if water still exists around the block.
Also, when the world is exited and reloaded, the water spawns where the air bubble/tunnels were as if there was nothing ever there.
Pretty much, the game isn't FULLY registering that the water is actually gone.
Now, if I were to take this action and copy/paste it's action into an item like, say, the bow, and make it so that instead of shooting an arrow, an air bubble will appear around the player, it works just fine. The bubble appears, and the water caves it in like it should.
Also, if I want to have a fire bending move be used and set entities near the player on fire, it doesn't fully work in the onTickInGame event. It will set the entities on fire, but they will not take damage, and the fire will dissipate as soon as they leave the vicinity of the player.
And if I want to have a player be able to shoot an arrow out of their armor, it will fire, but it won't hurt the enemies, and it will generate a blank box instead of an arrow.
What I'm trying to say is that the game doesn't seem to register these events properly through the onTickInGame event, and I can't figure out why. It only half captures the event.
I'm 99% certain it is something simple, but I'm unable to figure out what is. In fact, I'm almost positive it has to do with using events or using the CommonHandler instead of the ClientHandler, and if that IS the error, it'd be really nice if someone could just link me to a proper tutorial of how to use events, because I can't find one that will address something like that.
I'm having this bizzare error right now with my mod. I'm trying to use Ticker class (and then the onTickInGame() method) to make armors that have special abilities.
Now, when I try to create a new world, the game will start loading, and then it will tell me that it's "shutting down internal server" and then I get an error message, so the error is based strictly around the loading of the world.
Here is the code for that:
public class JoeTicker implements ITickHandler
{
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
}
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
if(type.equals(EnumSet.of(TickType.CLIENT)))
{
Minecraft mc = Minecraft.getMinecraft();
GuiScreen curScreen = Minecraft.getMinecraft().currentScreen;
if(curScreen != null)
{
onTickInGui(mc, curScreen);
}
else onTickInGame(mc);
}
}
private void onTickInGame(Minecraft minecraft)
{
EntityPlayer p = FMLClientHandler.instance().getClient().thePlayer;
ItemStack boots = p.inventory.armorInventory[0];
ItemStack legs = p.inventory.armorInventory[1];
ItemStack chest = p.inventory.armorInventory[2];
ItemStack helm = p.inventory.armorInventory[3];
if (boots.itemID == BaseModJoe.bronzeBoots.shiftedIndex)
{
if (Keyboard.isKeyDown(mc.gameSettings.keyBindJump.keyCode) && minecraft.thePlayer.motionY > 0.0D)
{
p.motionY += 1.0D; //Change this value to how high you wnat the player to jump
p.speedInAir = 0.5F; //Change this value to set the speed while in air
}
minecraft.thePlayer.fallDistance = 0.0F;
}
}
private void onTickInGui(Minecraft minecraft, GuiScreen gui)
{
}
@Override
public EnumSet<TickType> ticks() {
// TODO Auto-generated method stub
return EnumSet.of(TickType.CLIENT, TickType.RENDER);
}
@Override
public String getLabel() {
// TODO Auto-generated method stub
return "TickHandler.CLIENT";
}
}
What's REALLY weird about this error is that, if I simply comment out a few lines so that it looks like this:
public class JoeTicker implements ITickHandler
{
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
}
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
if(type.equals(EnumSet.of(TickType.CLIENT)))
{
// Minecraft mc = Minecraft.getMinecraft(); **this line
GuiScreen curScreen = Minecraft.getMinecraft().currentScreen;
if(curScreen != null)
{
onTickInGui(mc, curScreen);
}
else onTickInGame(/*mc*/); **this argument
}
}
private void onTickInGame(/*Minecraft minecraft*/) **this argument here**
{
**This whole method here**
/* EntityPlayer p = FMLClientHandler.instance().getClient().thePlayer;
ItemStack boots = p.inventory.armorInventory[0];
ItemStack legs = p.inventory.armorInventory[1];
ItemStack chest = p.inventory.armorInventory[2];
ItemStack helm = p.inventory.armorInventory[3];
if (boots.itemID == BaseModJoe.bronzeBoots.shiftedIndex)
{
if (Keyboard.isKeyDown(mc.gameSettings.keyBindJump.keyCode) && minecraft.thePlayer.motionY > 0.0D)
{
p.motionY += 1.0D; //Change this value to how high you wnat the player to jump
p.speedInAir = 0.5F; //Change this value to set the speed while in air
}
minecraft.thePlayer.fallDistance = 0.0F;
}
*/
}
private void onTickInGui(Minecraft minecraft, GuiScreen gui)
{
}
@Override
public EnumSet<TickType> ticks() {
// TODO Auto-generated method stub
return EnumSet.of(TickType.CLIENT, TickType.RENDER);
}
@Override
public String getLabel() {
// TODO Auto-generated method stub
return "TickHandler.CLIENT";
}
}
Minecraft will load me a new world.
If I THEN uncomment out of those lines so that they're working code again and then try to load an existing world, the world will load with no problem and the mod will work just fine. The boots grant higher jumping and everything.
I would just like some help trying to figure this one out. I'm sure it's one line that I've gotta change and it'll be done pretty quickly.
Also here is the crash error report that I get
java.lang.NullPointerException
at joelasher.minemod.JoeTicker.onTickInGame(JoeTicker.java:46)
at joelasher.minemod.JoeTicker.tickEnd(JoeTicker.java:32)
at cpw.mods.fml.common.SingleIntervalHandler.tickEnd(SingleIntervalHandler.java:22)
at cpw.mods.fml.common.FMLCommonHandler.tickEnd(FMLCommonHandler.java:138)
at cpw.mods.fml.common.FMLCommonHandler.onPostClientTick(FMLCommonHandler.java:362)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1912)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:846)
at net.minecraft.client.Minecraft.run(Minecraft.java:771)
at java.lang.Thread.run(Thread.java:722)
I have an odd issue trying to decompile the mcp project:
!! Modified jar detected. Unpredictable results !! == Decompiling server using fernflower == > Creating SRGs > Applying RetroGuard '"C:\Program Files\Java\jdk1.7.0_09\bin\java" -cp "runtime\bin\retroguard.jar;lib;lib\*;jars\bin\mine...' failed : 1 == ERRORS FOUND == Unrecoverable error during obfuscation, see log file for details. RetroGuard error: COM.rl.obf.classfile.ClassFileException: ClassNotFound bbv ================== Decompile failed
Any ideas as to what could cause this error? This is my first time setting it up and it's giving me a big headache. I've been re-downloading everything and re-setting the jdk path and I can't seem to get this to work.
0
world.setBlock(x+5, y+1, z+5, Blocks.mob_spawner, 5, 0);
TileEntityMobSpawner spawn = (TileEntityMobSpawner)world.getTileEntity(x+5, y+1, z+5);
spawn.func_145881_a().setEntityName("Zombie");
This will spawn zombies.
Thanks!
0
I have included some pictures. As you can see if shows that getSpawnerogic is throwing an error because it's undefined:
Trying to let the IDE fix the error doesn't help. The two fixes for this are pretty much useless.
Here is another image to show the autocomplete dropdown list that eclipse shows. No getSpawnerLogic() is shown.
Any thoughts on what could be causing this? I've made no edits to the original TileEntityMobSpawner class (I can't even find it to look at it if I wanted to help myself)
EDIT: Also, for what it's worth, I'm not using it to spawn a custom entity. It's just for existing mobs.
0
world.setBlock(x+5, y+1, z+5, Blocks.mob_spawner, 5, 0);
TileEntityMobSpawner spawn = (TileEntityMobSpawner)world.getTileEntity(x+5, y+1, z+5);
I have the block and I set it to be a TileEntitySpawner, but when trying to do
spawn.getSpawnerLogic().setMobID(EntityHere);
I get an error on getSpawnerLogic because it can't find it. I can't find a similar replacement function either. I don't know if the method doesn't exist or if I'm actually missing something. I couldn't find an answer to this question on the forums after a quick search. Any fixes?
0
I'm positive it's something basic, but it's been stumping me for days and I can't find anything online that'll help (it's probably just that simple really)
First things first, here's the code for my ticker class. It's registered in a client proxy already as well.
What the code is supposed to do is allow the player to jump higher and, when the player holds down the M key, any water around him will turn into air, which means that the player can make an air bubble around them when they're underwater.
To start, the code works in that the water around the player WILL turn into air. However, the water around the new air bubble doesnt fall back into place when the player releases the button, meaning that the bubble will stay permanent and won't collapse on itself. This makes for something odd looking tunnels through the water.
Also, when a block is placed inside the new bubble, water will spawn around it, as if water still exists around the block.
Also, when the world is exited and reloaded, the water spawns where the air bubble/tunnels were as if there was nothing ever there.
Pretty much, the game isn't FULLY registering that the water is actually gone.
Now, if I were to take this action and copy/paste it's action into an item like, say, the bow, and make it so that instead of shooting an arrow, an air bubble will appear around the player, it works just fine. The bubble appears, and the water caves it in like it should.
Also, if I want to have a fire bending move be used and set entities near the player on fire, it doesn't fully work in the onTickInGame event. It will set the entities on fire, but they will not take damage, and the fire will dissipate as soon as they leave the vicinity of the player.
And if I want to have a player be able to shoot an arrow out of their armor, it will fire, but it won't hurt the enemies, and it will generate a blank box instead of an arrow.
What I'm trying to say is that the game doesn't seem to register these events properly through the onTickInGame event, and I can't figure out why. It only half captures the event.
I'm 99% certain it is something simple, but I'm unable to figure out what is. In fact, I'm almost positive it has to do with using events or using the CommonHandler instead of the ClientHandler, and if that IS the error, it'd be really nice if someone could just link me to a proper tutorial of how to use events, because I can't find one that will address something like that.
0
Now, when I try to create a new world, the game will start loading, and then it will tell me that it's "shutting down internal server" and then I get an error message, so the error is based strictly around the loading of the world.
Here is the code for that:
What's REALLY weird about this error is that, if I simply comment out a few lines so that it looks like this:
Minecraft will load me a new world.
If I THEN uncomment out of those lines so that they're working code again and then try to load an existing world, the world will load with no problem and the mod will work just fine. The boots grant higher jumping and everything.
I would just like some help trying to figure this one out. I'm sure it's one line that I've gotta change and it'll be done pretty quickly.
Also here is the crash error report that I get
0
!! Modified jar detected. Unpredictable results !!
== Decompiling server using fernflower ==
> Creating SRGs
> Applying RetroGuard
'"C:\Program Files\Java\jdk1.7.0_09\bin\java" -cp "runtime\bin\retroguard.jar;lib;lib\*;jars\bin\mine...' failed : 1
== ERRORS FOUND ==
Unrecoverable error during obfuscation, see log file for details.
RetroGuard error: COM.rl.obf.classfile.ClassFileException: ClassNotFound bbv
==================
Decompile failed
Any ideas as to what could cause this error? This is my first time setting it up and it's giving me a big headache. I've been re-downloading everything and re-setting the jdk path and I can't seem to get this to work.