Jump to content

SevenDeadly

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by SevenDeadly

  1. I suspected as much, however I was hoping there was another way. Trig it is I suppose.
  2. I am trying to spawn a multitude of particles and then shoot a fireball, with all particles and entities spawning directly above the player's hand. The player isn't holding an item at the time in which this needs to be occurring, so I can't use the item being held as a reference. I already found a way to spawn particles and shoot entities when the player isn't holding any items or anything, however I can't think of a way of positioning where it all spawns correctly. Setting the Y coordinate where it should spawn is easy, but I can't think of a way to use the X and Z coordinate to always position the particle/entity where it needs to be. Any ideas?
  3. I am trying to make a new HUD to add onto my game (similar to an experience bar). I have it rendering onto the screen, the only problem I am having is with the placement of it. Since the placement goes by pixels, what may be the perfect location on a full screen may be located in the middle of the screen if the player re-sizes the window. How could I make it fixed in a certain location relative to the game? For example, the hotbar and experience bars are always in the bottom-center of the screen.
  4. That solved it, thanks. What's the point in naming a method isCollidable if it doesn't affect collision? Is it possibly for projectiles such as arrows and snowballs?
  5. How do I make a block that players and entities can walk through? I tried overriding isCollidable and returning false, but this still blocks me from walking through it. The only thing returning it false does is make it so I can't view the block's bounds box (that little black outline when you look at a block) and it won't let me hit it. Any ideas? Block Code: public class BlockMyBlock extends Block { public BlockMyBlock(int id, Material material) { super(id, material); setBlockUnbreakable(); setStepSound(Block.soundStoneFootstep); setUnlocalizedName("myblock"); setCreativeTab(MyMod.myTab); setLightOpacity(0); } @Override @SideOnly(Side.CLIENT) public boolean isCollidable() { return false; } @Override @SideOnly(Side.CLIENT) public boolean renderAsNormalBlock() { return false; } @Override @SideOnly(Side.CLIENT) public boolean isOpaqueCube() { return false; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister icon) { blockIcon = icon.registerIcon(mymd:myblock); } }
  6. There's no tutorial on the wiki on ThrowableEntities, and ThrowableEntities are obviously different than normal Entities. <.<
  7. If you are talking about this: EntityRegistry.registerModEntity(EntityProjectileName.class, "WaveBolt", CUSTOM ENTITY ID, this, 64, 1, true); Then yes and no. It's in another class to keep my organization, but the method containing it is called from the load method. So it's essentially like having it in the load method of my main.
  8. Every time I throw the entity now, I still have an invisible texture. However, I also get this error: net.minecraft.util.ReportedException: Adding entity to track 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:219) 2013-09-23 15:20:38 [iNFO] [sTDERR] at cpw.mods.fml.common.registry.EntityRegistry.tryTrackingEntity(EntityRegistry.java:363) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:64) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.world.WorldManager.onEntityCreate(WorldManager.java:37) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.world.World.onEntityAdded(World.java:1587) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.world.WorldServer.onEntityAdded(WorldServer.java:923) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.world.World.spawnEntityInWorld(World.java:1578) 2013-09-23 15:20:38 [iNFO] [sTDERR] at me.myMod.items.ItemBall.onItemRightClick(ItemBall.java:38) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.item.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:353) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:540) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:689) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) 2013-09-23 15:20:38 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException 2013-09-23 15:20:38 [iNFO] [sTDERR] at cpw.mods.fml.common.network.EntitySpawnPacket.generatePacket(EntitySpawnPacket.java:75) 2013-09-23 15:20:38 [iNFO] [sTDERR] at cpw.mods.fml.common.network.FMLPacket.makePacket(FMLPacket.java:131) 2013-09-23 15:20:38 [iNFO] [sTDERR] at cpw.mods.fml.common.network.FMLNetworkHandler.getEntitySpawningPacket(FMLNetworkHandler.java:371) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTrackerEntry.getPacketForThisEntity(EntityTrackerEntry.java:495) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTrackerEntry.tryStartWachingThis(EntityTrackerEntry.java:385) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTrackerEntry.sendEventsToPlayers(EntityTrackerEntry.java:484) 2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:205) 2013-09-23 15:20:38 [iNFO] [sTDERR] ... 20 more RenderBall: @SideOnly(Side.CLIENT) public class RenderBall extends Render { private static final ResourceLocation texture = new ResourceLocation(MyModInfo.ID,"textures/entities/ball.png"); private Item field_94151_a; private int field_94150_f; public RenderBall(Item par1Item, int par2) { this.field_94151_a = par1Item; this.field_94150_f = par2; } public RenderBall(Item par1Item) { this(par1Item, 0); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f); if (icon != null) { GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); this.func_110777_b(par1Entity); Tessellator tessellator = Tessellator.instance; if (icon == ItemPotion.func_94589_d("bottle_splash")) { int i = PotionHelper.func_77915_a(((EntityPotion)par1Entity).getPotionDamage(), false); float f2 = (float)(i >> 16 & 255) / 255.0F; float f3 = (float)(i >> 8 & 255) / 255.0F; float f4 = (float)(i & 255) / 255.0F; GL11.glColor3f(f2, f3, f4); GL11.glPushMatrix(); this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay")); GL11.glPopMatrix(); GL11.glColor3f(1.0F, 1.0F, 1.0F); } this.func_77026_a(tessellator, icon); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } } @Override protected ResourceLocation func_110775_a(Entity par1Entity) { return texture; } private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon) { float f = par2Icon.getMinU(); float f1 = par2Icon.getMaxU(); float f2 = par2Icon.getMinV(); float f3 = par2Icon.getMaxV(); float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); par1Tessellator.startDrawingQuads(); par1Tessellator.setNormal(0.0F, 1.0F, 0.0F); par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3); par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3); par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2); par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2); par1Tessellator.draw(); } } Entity Registration (Method in common proxy, called from my load method in my Main Class though) public void registerEntities() { EntityRegistry.registerModEntity(EntityBall.class, "Ball", 257, MyMod.instance, 64, 1, true); } Rendering Registration and other Entity Registration (Of course this is in the client proxy method registerRenderers and registerEntities:)) @Override public void registerRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntityBall.class, new RenderBall(Items.ballItem)); } @Override public void registerEntities() { EntityRegistry.registerGlobalEntityID(EntityBall.class, "Ball", EntityRegistry.findGlobalUniqueEntityId()); }
  9. Title says it all. If I make an item that fires an entity (Let's say an exploding baseball as an example ) on right click, it shoots an invisible entity (I am certain it is shooting it, because onImpact it has the properties of my Throwable Entity). Since they changed the way you used to register the texture for EntityThrowable Entities, how do you do it now?
  10. It's working out fine so far. Thank you for all of your help guys!
  11. I wouldn't be changing the base-class of the blocks. I would get the blocks default value, store it in a variable, then call the setHardness method from one of my custom classes. If the player needs to be able to edit the blocks, I can have a command that, when used, calls a method that resets all the blocks to their default value. Simple as that.
  12. I actually just thought of a really simple way to do this without doing anything too drastic. I just need to use: Block.someBlock.setHardness(1000);
  13. Where would you recommend I start with reflections? I haven't had any experience with reflections. (Not really that far into Java yet.)
  14. That would work for custom items, but I need to disable the breaking of blocks with the fist and vanilla items somehow as well.
  15. That was one of my first thought (cancelling the event) before I tried to set allowEdit to false. However, setting the event to canceled did not affect anything at all. That's why I tried moving to setting allowEdit to false, as I hoped that would work. Neither or them worked, but I assume that finding a way to set allowEdit to false will be the easiest way to solve my problem.
  16. I am trying to set allowEdit to false so that players cannot break certain blocks(vanilla blocks included) with a certain item(vanilla items included) or the fist. However, setting capabilities.allowEdit to false doesn't seem to work. Any ideas? @ForgeSubscribe public void onPlayerBlockInteraction(PlayerInteractEvent event) { if(event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().itemID == Item.pickaxeDiamond.itemID) { event.entityPlayer.capabilities.allowEdit = false; event.entityPlayer.sendPlayerAbilities(); event.entityPlayer.addChatMessage("You cannot use this item yet!"); //This does successfully send the message, so the message works. } else { event.entityPlayer.capabilities.allowEdit = true; //Doesn't work whether this is here or not, so not a problem with this. event.entityPlayer.sendPlayerAbilities(); } } This is all in an event handler. I have tried setting allowEdit to false in other classes too (like a tick handler), however it still fails to work. allowFlying and disableDamage work though, so I do not understand why this doesn't... I am also trying to find a way to set allowEdit to false so the player can't edit any blocks at all for another mod I am making, so if anyone knows how to do that I would really appreciate your help. Thanks
  17. Do you know of any tutorials on making CoreMods? Never made one before, and I wouldn't have the slightest clue as to where I should start.
  18. Why are people so against core-mods then? Also, maybe I am thinking too far back, but I remember core-mods being the ones where you have to go out of your way to put them in the minecraft.jar (now minecraft-Version.jar). Did that change?
  19. Not necessarily. When I was a coding noob, I tried the same and found another method without editing base classes. At first create a new GuiScreen (I'll call it FakeGuiMainMenu) which is similar to the GuiMainMenu (so simply copy & paste). After that, add a client side tick handler to your mod. In the tickEnd() method, check if the current screen being is an instance of the GuiMainMenu. If so, then make Minecraft display your "fake" gui screen. package my.dummy.package; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class OpenGuiListener implements ITickHandler { @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu) { Minecraft.getMinecraft().displayGuiScreen(new FakeGuiMainMenu()); } } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.CLIENT); } @Override public String getLabel() { return "dummyMainMenuListener"; } } I made it earlier and it works sweet. Greets from Germany ~sep87x I tried doing this, but it doesn't seem to work. I get two errors: The first being that RunnableTitleScreen cannot be resolved to a type. When importing this, I get the error stating that RunnableTitleScreen is not a public class. The second being that GuiButton.width is not visible. I tried making custom classes (copying and pasting with little editing other than the names of a few methods such as constructors) of the classes causing the errors, which got rid of the errors being shown in my IDE. However, when running the game with this about one second after the MainMenu is shown the game crashes. Any ideas? Of course my class was loaded somewhere, I even stated where above the code when I posted the topic. As for making a CoreMod, I would rather just try and use "messy" code. Not only does it work fine, but it saves work on the user's side and makes installing less complex.
  20. Is it possible to add buttons to the MainMenu without editing Base Classes? I read something a while back about using a tickhandler to check for when the MainMenu GUI is open, and to replace it with a custom GUI. However, I feel like this is excessive if there is a way to add a button. I tried something somewhere along the lines of: called in the load method of the base-mod class import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.resources.I18n; public class GuiNewButton extends GuiMainMenu { private GuiButton newButton = null; public GuiNewButton() { newButton = new GuiButton(15, this.width / 2 - 100, 108 + 24 * 2, "New Button"); buttonList.add(newButton); } } out of curiosity, as it seemed pretty simple. Unfortunately it did not work, though. Any ideas? (Very new to modding, so sorry if what I tried is obvious that it would fail. I am completely oblivious to a lot of the classes, FML methods, etc.)
×
×
  • Create New...

Important Information

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