Everything posted by Reygok
-
[SOLVED] How to compile individual projects in a workspace
I only compile one project at a time. But perhaps there are things I don't know, since I don't really understand what you are saying at the beginning... But with what diesieben07 said before, is it really true that a forge update automatically updates my local forge version? That seems futuristic. And I still do a seperate build per project, thats not my problem. And yes, I do know that I don't have to build the mod to test it I only build it when I'm done with changes and want to release an update. But I'll check on diesieben07's method.
-
[1.8] Custom Bounding Box
Yeah I have the collisionBoxes, the wireframe is the issue. I googled around quite a bit now, but as I'm delving deeper into forge, there are less and less examples to learn from.. I really can't figure out how exactly to draw a wireframe
-
[SOLVED] How to compile individual projects in a workspace
Hm yeah, makes sense. But then I'd have to extract forge into a new folder and run setupDecompWorkspace everytime I make a new mod no? Or did I get that wrong "With their own forge"? And what are the disadvatages of my/BedrockMiners method? Because I got it to work now that way, by adding the src path to the build.gradle file.
-
[SOLVED] How to compile individual projects in a workspace
But there are a lot of benefits to this. Otherwise I have have a separate workspace for every mod, or is there another way?
-
[1.8] Custom Bounding Box
I created a block that is made up of up to 8 little blocks, so you can build a slab, a stair, or anything else possible with this configuration. Now, my problem is, the bounding box of the block has to be exactly the shape of the texture. How can I make a bounding box that's not a cuboid?
-
[SOLVED] How to compile individual projects in a workspace
Hello, I followed the advanced setup from BedrockMiner (http://bedrockminer.jimdo.com/modding-tutorials/set-up-minecraft-forge/set-up-advanced-setup/) so forge is a standalone project in Eclipse, and my mod is is another one. But I don't know how to compile now. I tried to run gradle build in severel folders, but I always only get a .jar with the MEFA-INF folder inside. Where to run the build command, and does the build file need more changes than when everything is in one place?
-
[SOLVED][1.8] Change TileEntity data when placing block on the same pos
Thanks man, I finally got everything to work
-
[SOLVED][1.8] Change TileEntity data when placing block on the same pos
Thanks, I'm slowly getting there Now I have a slight problem, when I set several booleans in the TileEntity, it doesn't update the texture, or only sometimes. When I place a block next to it, they load up. Is there a method to update the TileEntity somehow?
-
[SOLVED][1.8] Change TileEntity data when placing block on the same pos
I'm starting to think that you do your best to help as much as possible, so that I find it out by myself haha I'm already using a custom ItemBlock, otherwise I couldn't determine where to place the first TinyBlock. I just can't find the correct method to use for this case.
-
[SOLVED][1.8] Change TileEntity data when placing block on the same pos
Hi, I created a block, that uses a TileEntity, this is what it looks like: Now, I want to change the data of the TileEntity, when I click on the block where I'm aiming in the picture. So instead of placing another block on the BlockPos right to this one, the existing TileEntity should change. To be clear, the data I'm talking about is an array of booleans, size 8 (one for each possible tiny block position). So I want to change another boolean of the tileEntity on that location also to true, since now (on the picture) only one is true. Thanks in advance!
-
[SOLVED] SmartblockModel weird behaviour
Yeah, I kind of meant the bounding box and the collision box at the same time, because for my block they should be the same. Thanks
-
[SOLVED] SmartblockModel weird behaviour
Thanks, that was it! I didn't know you had to do this... now I've probably wasted hours and hours while it was working the whole time Another quick question, what are the differences between: (in the Block class) setBlockBounds() getSelectedBoundingBox() addCollisionBoxesToList() getCollisionBoundingBox() setBlockBoundsBasedOnState() And maybe other similar methods? What I need is a method to set the blocks hitbox, but depending on its state, which is an extendedState. Thanks in advance!
-
[SOLVED] SmartblockModel weird behaviour
Hi, since the subject completely changed from my first thread (http://www.minecraftforge.net/forum/index.php/topic,31184.0.html), I decided to make a new one. I followed the SmartblcokModel example from TheGreyGhost (https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe05_block_smartblockmodel2) but at first, I couldn't get it to work. I had fixed all error messages, but my block was still missing the texture; since I had no error messages anymore, I was helpless. The next day, I just started up eclipse, and added a console print somewhere, to find errors, and when I started up the game, my texture was there! I don't know why, but it suddenly worked. Problem is now, I have 8 model files, and a different one should load depending on where you click. However, it always loads the same one. Worse, it loads it from somewhere I don't know, because I even removed all the model files from my resources folder, but in the game the texture still loads. How is that possible? This probably explains why it wasn't working yesterday, and now, without a change, it does. Is there something that has to be refreshed after changing model files, before starting up the game?
-
[1.8] Metadata limited to 4 bits - possible alternatives
I'm sorry for double posting, but appearantly the thread got a bit lost. I tried to follow TheGreyGhosts Example about SmartBlockModels, but I can't get it to work, perhaps because I don't understand the part with the quads at all.. https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe05_block_smartblockmodel2 Could it also be a problem that IBakedModel is deprecated?
-
[1.8] Metadata limited to 4 bits - possible alternatives
Okay, I created an ItemBlockTinyBlock class, and the setTileEntityNBT inside it to set the NBT data in the tileentity, and I think it works. But for the rendering, I don't know how to "use getExtendedState", I did this: @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { if (state instanceof IExtendedBlockState) { // avoid crash in case of mismatch IExtendedBlockState stateExt = (IExtendedBlockState)state; TileEntityTinyBlock tileEntity = (TileEntityTinyBlock) world.getTileEntity(pos); System.out.println("Found tileentity, getting states"); boolean bot_nw = tileEntity.isBot_nw(); boolean bot_ne = tileEntity.isBot_ne(); boolean bot_se = tileEntity.isBot_se(); boolean bot_sw = tileEntity.isBot_sw(); boolean top_nw = tileEntity.isTop_nw(); boolean top_ne = tileEntity.isTop_ne(); boolean top_se = tileEntity.isTop_se(); boolean top_sw = tileEntity.isTop_sw(); return stateExt .withProperty(BOT_NW, bot_nw).withProperty(BOT_NE, bot_ne).withProperty(BOT_SE, bot_se) .withProperty(BOT_SW, bot_sw) .withProperty(TOP_NW, top_nw).withProperty(TOP_NE, top_ne).withProperty(TOP_SE, top_se) .withProperty(TOP_SW, top_sw); } return state; } But the method is never called. I presume I now have to use onBlockPlacedBy in some way, but I don't know what to do in there, since the vanilla super method is emtpy
-
[1.8] Metadata limited to 4 bits - possible alternatives
Yeah, as I said before, I noticed it's really unefficient ^^ But I didn't know I would get that many states when I thought about how to do it. Okay, yeah, I have a TileEntitiy, but I have no idea how to: 1. Set the shape of the block in the TileEntity, since this happens the moment the block is placed. So in which method do I do that? 2. "Transfer it to the renderer"? 3. Use IExtendedBlockstates, but perhaps I can find that one with The Grey Ghosts Tutorials (http://greyminecraftcoder.blogspot.com.au/) Thanks
-
[1.8] Metadata limited to 4 bits - possible alternatives
Oh okay Well thank you, that's very kind, because I took a closer look at onItemUse and the ItemBlock in general, and it is just so much new information and methods I don't fully understand... So, to my idea: I created a new block, TinyBlock, which will essentially be a smaller version (an 8th, to be exact) of most vanilla blocks. So there will be an extended class for each type, for now I only have TinyDirt, for testing purposes. You receive 8 of these TinyBlocks as a drop from a normal Dirt Block. Now, the moment you place it down, it should be placed exactly where you place it, in the corner of an empty 1x1x1 block space; so there are 8 possible locations. If you place 4 on one block, in a square, you created a Slab of dirt. That's the idea. My approach was to have the base class, TinyBlock, with 255 different states, because there are 256 different possibilities to place 8th blocks in the space of a normal sized block, minus "no block", so 255. Instead of having an enum with 255 cases, I divided the whole thing in a bottom and a top layer, and 4 possible facings for each layer. For one layer, there are now only 6 possible layouts, and each layer has a facing. Now there are a lot of redundant states, but I haven't figured out how to optimise it. The problem with this approach is the size of all of this, the model file for each type of tiny block will have hundreds of lines, and the method to place the block and decide the state it will be in has the same amount of cases, depending on 1. where you click, so where the "new" tiny block will render, and 2. the shape of the TinyBlocks already there. I hope you understand what I mean
-
[1.8] Metadata limited to 4 bits - possible alternatives
"As I said", well you said it in your head, because this method has not been mentioned in this thread. Perhaps you meant that you infered it by saying "when you query the world for the block state." But in that case you didn't understand what I meant by "I'm not a pro", because that means I never heard of that method, neither do I know what it does. Additionally, I think my general approach is not efficient, since it will require nested if's with over 200 different cases. Perhaps the jump is just too big, my first and only mod is the addition of a new ore and tools. I'm leaping too far here, obviously.
-
[1.8] Metadata limited to 4 bits - possible alternatives
I'm no pro at modding, you certainly noticed that. So my answer is, because the state of my block is set the instant it is placed. And what state it will be in, is decided by where you click, like with vanilla stairs. For those, in the onBlockPlaced method, the state is decided with the help of the hitX, hitY and hitZ parameters. But if I understand correctly, I cannot do it this way, since I'm using a TileEntity. Well then I have no idea how to do it, since my whole knowledge about modding is what you saw in my classes.
-
[1.8] Metadata limited to 4 bits - possible alternatives
Well, then I'm 100% helpless now, since I don't know another way of defining anything when placing a block than with this onBlockPlaced() method, since that's what I found by looking at vanilla stairs. And It seems that there are no tutorials similar to what I am doing, seems way too complicated for beginners
-
[1.8] Metadata limited to 4 bits - possible alternatives
@diesieben07 and @jabelar: Yeah, I really didn't know there is only one instance of a block I just followed basic tutorials, where this is never mentioned. So I thought when you place a block, it creates a new instance. Now that I think of it, this would be a whole ducking lot of data, and would make the game even laggier than it is haha Ok, that already helped, understanding what one is doing often helps find out error-sources by yourself EDIT: Ok, I got rid of that error, but now I have another one I don't even understand: [14:09:20] [server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_45] Caused by: java.lang.NullPointerException at com.reygok.octablocks.blocks.TinyBlock.onBlockPlaced(TinyBlock.java:95) ~[TinyBlock.class:?] at net.minecraft.item.ItemBlock.onItemUse(ItemBlock.java:73) ~[itemBlock.class:?] at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:570) ~[ForgeHooks.class:?] at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:146) ~[itemStack.class:?] at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:488) ~[itemInWorldManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:624) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:67) ~[C08PacketPlayerBlockPlacement.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:114) ~[C08PacketPlayerBlockPlacement.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] ... 5 more I'll just post my classes now: Main Class package com.reygok.octablocks; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import com.reygok.octablocks.blocks.TileEntityTinyBlock; import com.reygok.octablocks.blocks.TinyDirt; @Mod(modid = OctablocksMod.MODID, version = OctablocksMod.VERSION, name = OctablocksMod.NAME) public class OctablocksMod { public static final String MODID = "octablocks"; public static final String VERSION = "0.1"; public static final String NAME = "Octablocks"; public static Block tinyDirt; @EventHandler public void preInit(FMLPreInitializationEvent event) { tinyDirt = new TinyDirt(); GameRegistry.registerTileEntity(TileEntityTinyBlock.class, "tinyBlock_TE"); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new BlockBreakEventHandler()); if(event.getSide() == Side.CLIENT) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); ModelResourceLocation tinyDirtLoc = new ModelResourceLocation(MODID + ":" + ((TinyDirt) tinyDirt).getName(), "inventory"); renderItem.getItemModelMesher().register(Item.getItemFromBlock(tinyDirt), 0, tinyDirtLoc); } } } TinyBlock package com.reygok.octablocks.blocks; import java.util.Collection; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import com.google.common.collect.ImmutableMap; import com.reygok.octablocks.EnumShape; public class TinyBlock extends Block{ public static final PropertyEnum TOPSHAPE = PropertyEnum.create("topshape", EnumShape.class); public static final PropertyEnum BOTSHAPE = PropertyEnum.create("botshape", EnumShape.class); public static final PropertyDirection TOPFACING = PropertyDirection.create("topfacing", EnumFacing.Plane.HORIZONTAL); public static final PropertyDirection BOTFACING = PropertyDirection.create("botfacing", EnumFacing.Plane.HORIZONTAL); protected TinyBlock(Material materialIn) { super(materialIn); } @Override public TileEntity createTileEntity(World worldIn, IBlockState state) { return new TileEntityTinyBlock(); } public boolean isOpaqueCube() { return false; } public boolean isFullCube() { return false; } public int quantityDropped() { return 1; } public Item getItemDropped(int par1, int par2) { return Item.getItemFromBlock(this); } @Override protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {TOPSHAPE, TOPFACING, BOTSHAPE, BOTFACING}); } @Override public int getMetaFromState(IBlockState state) { return 0; } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { TileEntity tileentity = worldIn.getTileEntity(pos); TileEntityTinyBlock tileEntityTinyBlock = null; if (tileentity instanceof TileEntityTinyBlock) { // prevent a crash if not the right type, or is null tileEntityTinyBlock = (TileEntityTinyBlock) tileentity; } IBlockState iblockstate = this.getDefaultState(); if((double)hitX < 0.5D) {// WEST if((double)hitZ < 0.5D) {// NORTH if((double)hitY < 0.5D) {// BOTTOM tileEntityTinyBlock.setShapeNr(0); return iblockstate .withProperty(TOPSHAPE, EnumShape.ZERO) .withProperty(BOTSHAPE, EnumShape.ONE) .withProperty(TOPFACING, EnumFacing.NORTH) .withProperty(BOTFACING, EnumFacing.NORTH); } else {// TOP tileEntityTinyBlock.setShapeNr(4); return iblockstate .withProperty(TOPSHAPE, EnumShape.ONE) .withProperty(BOTSHAPE, EnumShape.ZERO) .withProperty(TOPFACING, EnumFacing.NORTH) .withProperty(BOTFACING, EnumFacing.NORTH); } } else {// SOUTH if((double)hitY < 0.5D) {// BOTTOM tileEntityTinyBlock.setShapeNr(1); return iblockstate .withProperty(TOPSHAPE, EnumShape.ZERO) .withProperty(BOTSHAPE, EnumShape.ONE) .withProperty(TOPFACING, EnumFacing.SOUTH) .withProperty(BOTFACING, EnumFacing.SOUTH); } else {// TOP tileEntityTinyBlock.setShapeNr(5); return iblockstate .withProperty(TOPSHAPE, EnumShape.ONE) .withProperty(BOTSHAPE, EnumShape.ZERO) .withProperty(TOPFACING, EnumFacing.SOUTH) .withProperty(BOTFACING, EnumFacing.SOUTH); } } } else {// EAST if((double)hitZ < 0.5D) {// NORTH if((double)hitY < 0.5D) {// BOTTOM tileEntityTinyBlock.setShapeNr(2); return iblockstate .withProperty(TOPSHAPE, EnumShape.ZERO) .withProperty(BOTSHAPE, EnumShape.ONE) .withProperty(TOPFACING, EnumFacing.EAST) .withProperty(BOTFACING, EnumFacing.EAST); } else {// TOP tileEntityTinyBlock.setShapeNr(6); return iblockstate .withProperty(TOPSHAPE, EnumShape.ONE) .withProperty(BOTSHAPE, EnumShape.ZERO) .withProperty(TOPFACING, EnumFacing.EAST) .withProperty(BOTFACING, EnumFacing.EAST); } } else {// SOUTH if((double)hitY < 0.5D) {// BOTTOM tileEntityTinyBlock.setShapeNr(3); return iblockstate .withProperty(TOPSHAPE, EnumShape.ZERO) .withProperty(BOTSHAPE, EnumShape.ONE) .withProperty(TOPFACING, EnumFacing.WEST) .withProperty(BOTFACING, EnumFacing.WEST); } else {// TOP tileEntityTinyBlock.setShapeNr(7); return iblockstate .withProperty(TOPSHAPE, EnumShape.ONE) .withProperty(BOTSHAPE, EnumShape.ZERO) .withProperty(TOPFACING, EnumFacing.WEST) .withProperty(BOTFACING, EnumFacing.WEST); } } } } } And the Entity for the TinyBlock package com.reygok.octablocks.blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TileEntityTinyBlock extends TileEntity { @Override public Packet getDescriptionPacket() { NBTTagCompound nbtTagCompound = new NBTTagCompound(); writeToNBT(nbtTagCompound); int metadata = getBlockMetadata(); return new S35PacketUpdateTileEntity(this.pos, metadata, nbtTagCompound); } private int shapeNr = 0; @Override public void writeToNBT(NBTTagCompound parentNBTTagCompound) { super.writeToNBT(parentNBTTagCompound); // The super call is required to save the tiles location parentNBTTagCompound.setInteger("shapeNr", shapeNr); } @Override public void readFromNBT(NBTTagCompound parentNBTTagCompound) { super.readFromNBT(parentNBTTagCompound); // The super call is required to load the tiles location shapeNr = parentNBTTagCompound.getInteger("shapeNr"); } public int getShapeNr() { return shapeNr; } public void setShapeNr(int shapeNr) { this.shapeNr = shapeNr; } }
-
[1.8] Metadata limited to 4 bits - possible alternatives
Okay, I tried that, but appearantly the game still needs the method "getMetaFromState()", because I get this error: java.lang.IllegalArgumentException: Don't know how to convert octablocks:tinyDirt[botfacing=north,botshape=zero,topfacing=north,topshape=zero] back into data... at net.minecraft.block.Block.getMetaFromState(Block.java:272) ~[block.class:?] So I tried to @Override this method, but what should I return? I tried like this: @Override public int getMetaFromState(IBlockState state) { return tileEntityTinyBlock.getShapeNr(); } I initialized the "shapeNr" int in the tileEntityTinyBlock to 0, but then I get a NullpointerException in the "getMetaFromState()" method... What's still missing?
-
[1.8] Metadata limited to 4 bits - possible alternatives
Okay, that was already pretty helpful, seems to be what I need. The problem is, I don't know how to implement it correctly. I was following the tutorials of Grey Ghost http://greyminecraftcoder.blogspot.com.au/ But he uses IBakedModel, which is now deprecated, but from his description, it fits my case better I'll take a closer look at his TileEntity version now
-
[1.8] Metadata limited to 4 bits - possible alternatives
I was with you up until "this way using a TileEntity". I have no idea how TileEntities work, even after watching a tutorial and looking at the vanilla TileEntities. Right now, the model used when the block is placed is decided based upon it's state. Which is set the moment it is placed, by the exact location I click. The problem occurs when the method "getMetaFromState" is called, because it can only return 16 different values, whereas I have 24 states. So, by using a TileEntity (somehow), I can bypass this problem, because what? Will the metadata then be ignored? I created a new TileEntity class, and put it into my custom block class, but what now? Do I simply create a variable "state" inside, and set it in the "onBlockPlaced" method in the block? I'm a bit confused right now, I'm not that deep into forge yet Thanks for any help!
-
[1.8] Metadata limited to 4 bits - possible alternatives
Hm thanks, I'll look at the TileEntity. But just to clarify, another info about my block: the state is decided the moment it is placed, like stairs, but it can change after placement, like slabs. Basically, it is an 8-th of a block, and you can build a slab with it, a stair, a full block or anything in between.
IPS spam blocked by CleanTalk.