Jump to content

gegy1000

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by gegy1000

  1. Thanks for your help! mod.getMod() is still needed for field.set(), but it can be forced to be static like all other annotations.
  2. Thanks for your help! mod.getMod() is still needed for field.set(), but it can be forced to be static like all other annotations.
  3. Hello, I am trying to harvest annotation data from mods to do a similar thing to what @Mod.Instance and @SidedProxy do. I am doing this by subscribing to the FMLConstructionEvent, and using the ASM harvested data to inject the values. This has been working great in the development environment, but when in a release build, it crashes with a NPE. ModContainer#getMod() returns null for other mods, causing the crash. I'm not sure if this is caused by the fact that they are ordered differently in the development environment or if it's something else. You can view the source here: https://github.com/iLexiconn/LLibrary/blob/1.9.4/src/main/java/net/ilexiconn/llibrary/LLibrary.java It crashes here: https://github.com/iLexiconn/LLibrary/blob/1.9.4/src/main/java/net/ilexiconn/llibrary/server/config/ConfigHandler.java#L54 Thanks in advance.
  4. Hello, I am trying to harvest annotation data from mods to do a similar thing to what @Mod.Instance and @SidedProxy do. I am doing this by subscribing to the FMLConstructionEvent, and using the ASM harvested data to inject the values. This has been working great in the development environment, but when in a release build, it crashes with a NPE. ModContainer#getMod() returns null for other mods, causing the crash. I'm not sure if this is caused by the fact that they are ordered differently in the development environment or if it's something else. You can view the source here: https://github.com/iLexiconn/LLibrary/blob/1.9.4/src/main/java/net/ilexiconn/llibrary/LLibrary.java It crashes here: https://github.com/iLexiconn/LLibrary/blob/1.9.4/src/main/java/net/ilexiconn/llibrary/server/config/ConfigHandler.java#L54 Thanks in advance.
  5. http://i.imgur.com/XbxQSfH.png Is there something wrong with https://github.com/iLexiconn/LLibrary/blob/1.9/src/main/java/net/ilexiconn/llibrary/server/ServerProxy.java#L35 ?
  6. Looks like the MinecraftServer instance is null (FMLCommonHandler#getWorldThread), and sidedDelegate is an instance of FMLServerHandler but the net handler is client-side.
  7. Handle FMLConstructionEvent in the ModContainer for the coremod part of the library. It provides you with the ASMDataTable. How did you think that crash was related to your packets? Put a breakpoint in the erroring method and check what is null there. Okay, thanks! I'll have a go at it.
  8. Sorry about that. Would there be another way be to detect those annotations? Also, I got it wrong. The crash is different. (Sorry D:) This is the crash http://pastebin.com/f4fFfvH1
  9. https://github.com/TimelessModdingTeam/JurassiCraft2/blob/master/src/main/java/org/jurassicraft/client/gui/SelectDinoGui.java#L158
  10. Oh, yeah, I should probably not send it from the client. Not sure why I thought of doing it like that. I was only using getEffectiveSide for debugging, I'm not using it for this. I'm also having the same crash, however, for a different packet. It is being sent to the server from inside my GUI class, so it definitely is on the client-side. Thanks.
  11. Change your '!world.isRemote' to 'world.isRemote'. World#isRemote is true on the client-side and false on the server-side.
  12. I am trying to send a packet to the server, and I am experiencing a crash. http://pastebin.com/6uqpJGCr While researching this crash, all the problems seemed to be from sending a packet to the server, while on the server-side. I am checking the side with worldObj.isRemote on my entity, that the packet is being sent from. FMLCommonHandler#getEffectiveSide() will also have the same outcome as world.isRemote, however FMLCommonHandler#getSide() will have a different output, but using that results in a different error when using sendToAll: http://pastebin.com/vMPK9cUH This is my message sending code in my entity class: if (worldObj.isRemote) { JurassiCraft.NETWORK_WRAPPER.sendToServer(new UpdateAnimationMessage(this)); } else { AnimationHandler.INSTANCE.sendAnimationMessage(this, newAnimation); // This calls sendToAll } You can view sendAnimationMessage here https://github.com/iLexiconn/LLibrary/blob/1.9/src/main/java/net/ilexiconn/llibrary/server/animation/AnimationHandler.java#L30. Thanks in advance.
  13. I have tried to use the default mappings, clear cache and remove the IntelliJ resources fix, the problem still persists.
  14. Hi When I try to use gradle build, it gives me this error: "java.util.zip.ZipException: duplicate entry: mcmod.info" I decided to check if there was an actual duplicate in the build jar, and there was. I checked some more, and found all the files were duplicated. So I removed the build.gradle, and got the error on another file. We have recently updated to the latest forge, this might be the problem but I'm not sure. Here is the build.gradle: "buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "gradle.plugin.net.minecraftforge.gradle:ForgeGradle:2.0.2" } } apply plugin: "net.minecraftforge.gradle.forge" version = "2.0.0-pre" group = "net.timeless.jurassicraft" archivesBaseName = "JurassiCraft" sourceCompatibility = targetCompatibility = "1.7" minecraft { version = "11.14.3.1552" runDir = "minecraft" replace '${version}', project.version mappings = "snapshot_20151107" } processResources { inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' expand 'version': project.version, 'mcversion': project.minecraft.version } from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } sourceSets { main { output.resourcesDir = output.classesDir } }"
  15. Yes - I know that, but I was wondering if Minecraft had something built into it that copies data from tileentity to itemstack. Anyway, I'll just write that code manually then.
  16. Okay, I'll leave out the rendering for now. But I still need to keep the data in the ItemStack NBT from the TileEntity.
  17. I am currently making a block similar to a mob spawner, it renders an entity inside it. I am using a TESR, just like the mob spawner and everything renders fine. However, I want it to save the entity that is inside it, and still render it while it is an ItemStack. I looked through the MC code and found that mob spawners actually use an ItemBlock. So I have set my block to use an ItemBlock too. This didn't change anything, not that I expected it to. So I looked some more into the MC code and I can't find anything that may be of use to this, so I've come here. Here is some of my code: package net.timeless.jurassicraft.common.block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemBlock; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.timeless.jurassicraft.common.api.ISubBlocksBlock; import net.timeless.jurassicraft.common.creativetab.JCCreativeTabs; import net.timeless.jurassicraft.common.item.ItemCage; import net.timeless.jurassicraft.common.tileentity.TileCage; public class BlockCage extends BlockOriented { public BlockCage() { super(Material.iron); this.setUnlocalizedName("cage_small"); this.setHardness(1.0F); this.setResistance(1.0F); this.setCreativeTab(JCCreativeTabs.blocks); } @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return false; } @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { return true; } @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileCage(); } } BlockRegistry: GameRegistry.registerBlock(cage_small, ItemCage.class, "cage_small"); GameRegistry.registerTileEntity(TileCage.class, "cage_small"); ItemCage: package net.timeless.jurassicraft.common.item; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; public class ItemCage extends ItemBlock { public ItemCage(Block block) { super(block); this.setUnlocalizedName("cage_small"); } } TileCage: package net.timeless.jurassicraft.common.tileentity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileCage extends TileEntity { private Entity entity; public void setEntity(Entity entity) { this.entity = entity; } public Entity getEntity() { return entity; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); int entityID = compound.getInteger("EntityID"); if(entityID != -1) { NBTTagCompound entityTag = compound.getCompoundTag("Entity"); entity = EntityList.createEntityByID(entityID, worldObj); entity.readFromNBT(entityTag); } } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagCompound entityTag = new NBTTagCompound(); if(entity != null) { entity.writeToNBT(entityTag); compound.setInteger("EntityID", EntityList.getEntityID(entity)); } else { compound.setInteger("EntityID", -1); } compound.setTag("Entity", entityTag); } } TESR: package net.timeless.jurassicraft.client.render.tileentity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntityCow; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.timeless.jurassicraft.common.entity.*; import net.timeless.jurassicraft.common.tileentity.TileCage; public class TileEntityRendererCage extends TileEntitySpecialRenderer { private static final Minecraft mc = Minecraft.getMinecraft(); @Override public void renderTileEntityAt(TileEntity tile, double posX, double posY, double posZ, float partialTicks, int p_180535_9_) { GlStateManager.pushMatrix(); TileCage cage = (TileCage) tile; Entity entity = cage.getEntity(); if(entity == null) { entity = new EntityGallimimus(tile.getWorld()); cage.setEntity(entity); } GlStateManager.translate((float)posX + 0.5F, (float)posY, (float)posZ + 0.5F); float f1 = 0.5F; GlStateManager.translate(0.0F, 0.4F, 0.0F); EnumFacing front = EnumFacing.getFront(tile.getBlockMetadata()); if(front == EnumFacing.EAST) front = EnumFacing.WEST; else if(front == EnumFacing.WEST) front = EnumFacing.EAST; GlStateManager.rotate((front.getHorizontalIndex()) * 90, 0, 1, 0); GlStateManager.translate(0.0F, -0.4F, 0.0F); entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F); mc.getRenderManager().renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); GlStateManager.popMatrix(); } } RenderingRegistry: ClientRegistry.bindTileEntitySpecialRenderer(TileCage.class, new TileEntityRendererCage()); Thanks - gegy1000
  18. If it's rendering a purple and black checker box, that means it cannot find the texture..
  19. I was thinking about sending packets from the client to the server, but firstly that would be quite inefficient and secondly the client could have some mods that the server doesn't.. (Although you could check on the server)
  20. That's unfortunate, because then it would be incompatible with other mods...
  21. You need to wrap Items.dye, 9 inside of an item stack. So it would be: new ItemStack(Items.dye, 1, 9) The second parameter is the stack size, so just set that to 1.
  22. You can use Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed()
  23. So, I have a mod where you get an item that you can put in your crafting table and get a random item. As the game starts, it goes through all the registered items and adds them and their sub items to a list that the game looks through when you put the item in the crafting table. My current problem is that getSubItems doesn't exist server side, so it crashes the server. I can't think of any way around this, and help would be greatly appreciated. Here is the code that finds all registered items: try { Field creativeTabField = null; for (Field field : Item.class.getDeclaredFields()) //Since getCreativeTab() is @SideOnly(Side.CLIENT) { if(field.getType() == CreativeTabs.class) { field.setAccessible(true); creativeTabField = field; break; } } for (Object object : Item.itemRegistry.getKeys()) { Item item = (Item) Item.itemRegistry.getObject((String) object); CreativeTabs tab = (CreativeTabs) creativeTabField.get(item); if(tab != null) { List<ItemStack> subtypes = new ArrayList<ItemStack>(); if(item.getHasSubtypes()) { try { item.getSubItems(item, tab, subtypes); } catch (Exception e) { System.err.println("Error while finding subitems for " + item.getUnlocalizedName() + "!"); e.printStackTrace(); } } else { subtypes.add(new ItemStack(item, 1, 0)); } for (ItemStack subtype : subtypes) { possibleItems.add(new RandomItem(subtype.getItem(), subtype.getItemDamage())); } } } } catch (Exception e) { e.printStackTrace(); } And here is the mod: http://www.planetminecraft.com/mod/randomite-mod/
  24. getSubItems is getting called for each of your armor pieces because all of the armor pieces you have registered are an instance of your class that is adding the subitems. Each armor piece is adding a full set to the game. Try only adding one sub item to the list. So it would be something like this: ItemStack stack = new ItemStack(this); stack.addEnchantment(enchantmenthere); list.add(stack);
  25. You can take a look at my mod JavalCars' source on GitHub. https://github.com/gegy1000/JavalCars It doesn't have any shooting, but it automatically goes up blocks and can drive around.
×
×
  • Create New...

Important Information

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