Everything posted by Atijaf
-
[1.8]Dropping item into world?
Thanks! I made sure to only run it on server side. It's working now, but basically... I have a TileEntity that stores ItemStacks. The amount it stores can vary, so if the container is full and the amount it can store is decreased, it checks if it can place the items that it can no longer stored, can be placed into the player's inventory. If not, spawn EntityItem below player. Unfortunately, when in creative mode, it always says the player has inventory space, even when he doesn't. So yeah. Don't test in creative mode. haha. Thanks for the help!
-
[1.8]Dropping item into world?
From inside a class that implements IInventory. The method is called on both Server and client. As for player.lastTickPos, I've noticed that sometimes "player.playerLocation" or "player.posX" is null.
-
[1.8]Dropping item into world?
EntityItem droppedItem = new EntityItem(player.worldObj, player.lastTickPosX, player.lastTickPosY + 2, player.lastTickPosZ, stack.copy()); player.worldObj.spawnEntityInWorld(droppedItem); There is obviously something wrong with my code, because it isn't working. I'm just unable to find it... Any help will be great.
-
[1.8] Accessing TileEntity from gui? [SOLVED]
haha, duhh! dang I can't believe I missed that. Thanks!
-
[1.8] Accessing TileEntity from gui? [SOLVED]
I have a variable within my TileEntity that is used to determine which items are shown. This variable will be changed within the gui. GuiModTileEntity public class GuiModTileEntity extends GuiContainer{ private int tabX = 250; private int tabY = 220; public GuiModTileEntity(IInventory playerInv, ModTileEntity te) { super(new ContainerModTileEntity(playerInv, te)); this.xSize = 274; this.ySize = 224; } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { } /** THIS METHOD */ @Override protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { //Set variable within ModTileEntity? } } How can I access the current tile entity that is activated, or should I go about it a different way?
-
[1.8] Gui Scroll bar? [SOLVED]
That was exactly what I needed. Thanks for the help once again!
-
[1.8] Gui Scroll bar? [SOLVED]
How can I go about making a scroll bar?
-
Checking if a block is within a radius of player?
What methods would help me within the TileEntity?
-
Checking if a block is within a radius of player?
I haven't got the exact idea down or what my "wasteland" idea is, so lets use a silly example. Lets say the world is really hot and I have air conditioning blocks. The closer you are to this ac block, the less hot you are. The further away you are, the more hot you are and the more chance you have of losing health. While that's not exactly how the player will see it, that is exactly what the code will be doing. (Kinda like your health could be the number of potatoes you have, and if you have 0 potatoes, you die... Idek hahaha!)
-
Checking if a block is within a radius of player?
Is there a way to efficiently check if a specific block is within the range of a player, without checking every block?. (Atleast 100 blocks)
-
Manually destroy armor/remove armor from armor slot?
Strange. I thought I tried that... inventory.armorInventory[1-4] = null; Either way, it's working now. Thankyou!
-
Manually destroy armor/remove armor from armor slot?
How can I remove, or destroy, armor from the player from within playerTickEvent?
-
Stack size?
When Creating a new recipe, you get to choose the amount of the result; // This GameRegistry.addRecipe(new ItemStack(Blocks.stone, 10), new Object[] {"CCC","CCC","CC ", 'C', Blocks.cobblestone}); I want to retrieve the number 10 from within the even "ItemCraftedEvent", but have run into a wall. @SubscribeEvent public void onCraft(ItemCraftedEvent event){ int amount = event.crafting.stackSize;//This should return 10 right? Returns 0... Amount is 0 when it should be 10. Am I missing something?
-
HashMap of ItemStacks?
Thank you for the replies. I will probably create a wrapper class that holds the item, stack size(Maybe), and metadata and override hashcode.
-
HashMap of ItemStacks?
How would I put and obtain the values within hashmap. It always returns null? class 1 public static HashMap<ItemStack, Integer> Levels = new HashMap(200) ...//code ItemStack stack = new ItemStack(Blocks.stone); Levels.put(stack, 5) class2 ItemStack stack = new ItemStack(Blocks.stone); int requiredLevel = Levels.get(stack)//Is Null
-
[1.8]Obtain crafting table output? [SOLVED]
I have a skill, named crafting skill (Imagine that), and every crafting recipe gives a said amount of xp.. I have all that working, so to the point. Is there a way to obtain if the player takes the item out of the crafting table and what that item is?
-
[1.8]Crafting reciepe error[SOLVED]
This is just a guess, but you seem to be missing a parenthesis at the end of this bit of code GameRegistry.addRecipe(new ItemStack(test_block),new Object[]{"ddd","ddd","dd ",'d',Blocks.dirt});<-- Add this Let me know if that does anything.
-
[1.8] Stopping the player from receiving item after crafting [SOLVED]
Thank you all for the amount of replies and discussions. I have been away from home and am delighted to see all these answers to my question. I will probably be using diesieben07's tutorial, even though I will be replacing many crafting recipes, if not all. I would like complete control and customizable crafting recipes as well as requirements to craft them, so with diesieben07's tutorial, it looks like I can have that. Again, thanks for all the input. It helped me immensely! Edit: With a few tweaks here and there, I was able to recreate my own way of adding recipes (i.e. extending shapedOreRecipes) This way, I can now use my new class, which is pretty much a copy of shapedOreRecipes, except I added a few variables such as required level and skill name. No need to create a new class for each recipe.
-
[1.8] Stopping the player from receiving item after crafting [SOLVED]
Not appearing in the output would be neat, but not required. Honestly, any of those will work. Whichever is easier I suppose. I believe you when you say it's not easy. I've looked around a little bit and haven't found too much. This is similar to what I found, but was confused and was hoping to find an alternative. Also, incompatibility is just fine. It's the only mod my friends and I will be using. Yes.
-
[1.8] Stopping the player from receiving item after crafting [SOLVED]
Restrict recipes for certain players.
-
[1.8] Stopping the player from receiving item after crafting [SOLVED]
Is there some way to stop the player from obtaining the item crafted? I have used this @SubscribeEvent public void onItemCrafted(ItemCraftedEvent event){ event.player.inventory.setItemStack(null) } which deletes what the player is holding with the mouse. However, if the player shift clicks the item, he still gets it. I would prefer to leave the shift clicking ability in there.
-
[1.7.10]Saving an int with NBT [Solved]
I understand the frustration with learning OOP, but if each player is to have their OWN set of variables, you need to remove the static keyword from playerHuman, playerVampire, playerWerwolf inside your ExtendedPlayer class. Removing the static keyword will make those variables owned by the object and not the class. Alright, so now you have many errors. Most of those errors are probably trying to acquire playerHuman, playerVamp, and playerWerewolf variables. What you were previously doing was trying to obtain the class variables, so now you need to obtain the object's variables. To obtain the Object: So you already have the getter for the object. public static final ExtendedPlayer get(EntityPlayer player){ return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_VZPLAYER); } Which is great. This will be used. Inside your public class "PlayerTransformed" and right before that first if statement, add this. ExtendedPlayer extended_player = ExtendedPlayer.get(event.player); We make use of the get method you have. That obtains the instance from your class and you can now play with the variables inside using the ExtendedPlayer object, extended_player. Hopefully this will solve the errors you are having. As for saving, we wont know until this is done.
-
[1.8]Getting incorrect texture from grass[Solved]
Note, that you can't jusy copy these methods from grass block, otherwise all mimiced blocks will be recolored... And you will get green planks... Thanks for telling me that. I had a feeling, but wasn't sure. However, I did test the wood and it comes out fine, but then I tested tall grass and redstone. The tall grass was gray and the redstone was green:p So I looked at the code from both classes and came up with something that seemed to have worked. It takes the only blocks that actually use this color coding stuff, or atleast the ones I currently know about... So I will be patching it as I see others that need it @SideOnly(Side.CLIENT) public int getRenderColor(IBlockState state){ if(state == Blocks.redstone_wire.getDefaultState()){//This will make the mimiced redstone line look like it's off (red) float f1 = 0.3F; float f2 = 0.0F; float f3 = 0.0F; int j = MathHelper.clamp_int((int)(f1 * 255.0F), 0, 255); int k = MathHelper.clamp_int((int)(f2 * 255.0F), 0, 255); int l = MathHelper.clamp_int((int)(f3 * 255.0F), 0, 255); return -16777216 | j << 16 | k << 8 | l; } return this.getBlockColor(); } @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { TileEntity tile_entity; IBlockState state = worldIn.getBlockState(pos); if(worldIn.getTileEntity(pos) instanceof TileEntityMimicBlock){ tile_entity = (TileEntityMimicBlock)worldIn.getTileEntity(pos); state = ((TileEntityMimicBlock) tile_entity).getState(); if(state == Blocks.grass.getDefaultState() || state.getBlock() == Blocks.tallgrass) return BiomeColorHelper.getGrassColorAtPos(worldIn, pos); return getRenderColor(state); } return getRenderColor(state); }
-
[1.8]Getting incorrect texture from grass[Solved]
Thanks a bunch! I copied this over from the grass block and I've tested it and it seems to work. @SideOnly(Side.CLIENT) public int getBlockColor(){ return ColorizerGrass.getGrassColor(0.5D, 1.0D); } @SideOnly(Side.CLIENT) public int getRenderColor(IBlockState state){ return this.getBlockColor(); } @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { return BiomeColorHelper.getGrassColorAtPos(worldIn, pos); } out of curiosity, would you know whether or not I should copy the block's Model In my TileEntity?
-
[1.8]Getting incorrect texture from grass[Solved]
I have a a tile entity called mimic block. It mimics other blocks textures from it's state, and it seemed to be working great until I tried it on grass. It gives me a strange texture. The strange texture I'm getting https://gyazo.com/05e6d28803f8ec71565c578aad6f97e2 TileEntityMimicBlock http://pastebin.com/QvZi553P MimicBlock http://pastebin.com/uGUKsVYM MimicBlockISmartBlockModelFactory http://pastebin.com/J1w1EEVx Any ideas as to what would cause that?
IPS spam blocked by CleanTalk.