Jump to content

ShaneCraft

Members
  • Posts

    51
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

ShaneCraft's Achievements

Stone Miner

Stone Miner (3/8)

4

Reputation

  1. Nowhere in your thread have you asked for the above, anyway, entities derived from EntityLivingBase can be walked through. By looking at the boats class you can see you can't walk through a boat, rather you walk on top of it like a halfslab. Some collision method(s) in the Entity class does not allow another entity to walk through it, I don't have time to search for it right now, maybe when I get back and remember it I can update this post. But I'd suggest to look into anything related to colliding in the Entity class or better, check what methods are overriden in the EntityLivingBase class containing something relevant to colliding. If you have not found anything, you could do something dirty using the collideWithNearByEntities method. Check for entities in your entity's AABB, if that entity is inside of the AABB 'teleport' it back 1 position in the entity's current position. Something like this could create a jittery effect when the player keeps colliding with your entity, but that's like I said a dirty solution.
  2. Well it's not really that hard to accomplish, just override all methods containing collide and or push. Any how, here is the fix: // if your entity is an instance of entityliving, you can disable leashing as well. @Override public boolean allowLeashing() { return false; } // I think this is used when the player has attacked this entity, could be wrong. @Override public void onCollideWithPlayer(EntityPlayer entityIn) {} // this actually allows for damaging the entity, when it get hit it knocks the entity back, // if you'd want to prevent that you have to override EnitityLivingBase#knockBack. @Override public boolean canBeCollidedWith() { return false; } // obviously we dont want this @Override public boolean canBePushed() { return false; } // not any entity can collide. if you want projectiles to still be // effective, you will have to handle those yourself @Override protected void collideWithEntity(Entity p_82167_1_) {} // checks for any entity within a certain boundingbox, eg minecarts @Override protected void collideWithNearbyEntities() {}
  3. Simply by override the GuiScreen#mouseClicked(int x, int y, int mouseId) like this: @Override /** @param x = relative mouse position x @param y = relative mouse position y @param mouseId = mouse button being pressed */ protected void mouseClicked(int x, int y, int mouseId) { super.mouseClicked(x, y, mouseId); this.initGui(); } Do not call the initGui method during the actionPerformed method because when the mouse is pressed on top of a GuiButton it goes into a loop. When you draw a new button on the same location and the mouse is not released, it continues the loop (the code gets executed immediately so you can never time it when to release your mouse . So when the mouseClicked is done (super call), you re initialize your gui elements. There is no double clicking involved, just fast execution. ;] Note, when writing in Java you should rename the button classes to start with a capital letter. http://journals.ecs.soton.ac.uk/java/tutorial/java/javaOO/classdecl.html
  4. You have 2 options: 1. You can override the mapping done by the RenderManager by registering a new renderliving class to the EntityPlayer. 2. There is an event, RenderLivingEvent.Pre, that cancels the doRender method in RenderLiving classes. Allowing you to render a new renderliving class for that entity. by calling the doRender method again during the event. Small example : private final RenderPlayer2 renderPlayer = new RenderPlayer2(); @SubscribeEvent void overrideRenderPlayer(RenderLivingEvent.Pre event) { if (event.entity instanceof EntityPlayer) { event.setCanceled(true); renderPlayer.doRender(/* what ever parameters */); } }
  5. Why are you using the client instance of type EntityPlayer while there is an EntityPlayer object in the parameter?
  6. 1) I am not certain, but setting the maxdamage to negative value Should work, because the game checks if the current damage value is 0. 2) With a simple raytrace, you can find an example in Minecraft class using the player's arm length as max raytrace length.
  7. Add the following to your tileentity class @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { NBTTagCompound nbttagcompound = pkt.func_148857_g(); this.readFromNBT(nbttagcompound); } @Override public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, nbttagcompound); } this will sync to the client, mostly used for renders.
  8. InventoryPlayer inventory = new InventoryPlayer(player); inventory.copyInventory(player.inventory); for(ItemStack itemstack : inventory.mainInventory) { if(itemstack != null && itemstack.getItem() != null && itemstack.getItem() == Items.apple) { System.out.println("apple found"); } }
  9. Not entirely, if you want to use the default chest gui, you can implement the IInventory interface to your entity and call EntityPlayer#displayGUIChest. Basically take a look in net.minecraft.entity.item.EntityMinecartContainer.
  10. int dimension; EntityPlayer player = //get player from message; dimension = player.dimension; World world = DimensionManager.getWorld(dimension); if(world == null) return;
  11. ye, you're right, I should of called it, the way the furnace does it..
  12. proper way to break a block and it's respective tile entity:
  13. Are you trying to hide all item in your container? If so, the player's creative container does a cheaty way of hiding all items. It lifts them up by a couple thousand positions in the y coordinate. First of all, save the y positions of all the slots you want to 'hide' in an array, to keep the actual y position if you want to show the slots again. If you do not want to show them afterwards, you can skip this. [All of this code should be added to your guicontainer class] #1 You're talking about a button (on/off switch?), that's perfect to move the slots up. #2 Whenever you click on a button, for me it's when I click on a button which is an instance of GuiButtonOptions, it's set's the showOptions state to not equals to showOptions. ( if you're using id's for your buttons, you can just change this line to check whether the button id is the button for hiding the slots) Then I am moving all the container's slots up by 2000 (- = negative guitop) whether the showOptions is true, else I am setting their y position back on their original position using the array. I have used it in my entity's container as well, works fine for me.
  14. Sorry, but that is bs. All you have to do is change the rotation yaw + pitch. Those fields exists in EntityLivingBase. You can literally copy the EntityLookHelper class and let it pass EntityLivingBase or EntityPlayer in the constructor's parameter.
  15. Well... You can create your own faceEntity method? You would have to use EntityClientPlayerMP to change the yaw and pitch though. /** * Arguments: new yaw, new pitch. */ private void setPlayerRotation(float yaw, float pitch) { Minecraft mc = Minecraft.getMinecraft(); EntityClientPlayerMP ecpmp = mc.thePlayer; ecpmp.rotationYaw = yaw; ecpmp.rotationPitch = pitch; }
×
×
  • Create New...

Important Information

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