Everything posted by Flenix
-
making block bounds larger than 1x1x1
The only real way to do it is with gag blocks (fake blocks which become "part" of your block) There's various ways of doing it. Either use a TileEntity to store the locations, or just place and remove them at the same time as you place and remove the core block. This wont make the bounding box "bigger", but it will mean players can't walk through your block.
-
Issues with texturing the ItemBlock for my meta Tile Entity
he understands it fine, man. do you have a custom item for your block? if you don't, then you're probably gonna have to make a custom renderer to render your item properly. a custom renderer for your item not your tile entity. No- he hasn't even touched on the meta which is solely where the issue is. I don't want it to render 3D If I don't use meta on a block, it's 100% fine. Everything is exactly as I want it. Because I use meta on a few, the icons don't quite register properly. I want icons, not in-hand rendering. Here's a few screenshots which might explain it better. Everything I hold is related to everything I place in the screenshots: The icon in my hand correctly matches the block placed here: And here: And here: And even here: It's when I try and use a meta variation of the lights that I get issues.... What I want is to be able to change the icon (not rendered, not a 3D block, an icon) to match the metadata. It works everywhere else absolutely fine- it only breaks when I try and use metadata.
-
Issues with texturing the ItemBlock for my meta Tile Entity
I don't think you quite understand my issue If I set my render ID to 0 by removing that, it breaks the block in-game - it tries to render a solid block over my rendered block, like this: Right now, everything works absolutely fine when placed in the world. All I want is a simple icon to show it in the inventory. I have an icon- I just want to change the icon based on what metadata the block has. I don't want it to render 3D in my inventory (I wouldn't complain if it did, but it's not something I'm actively aiming for) Basically- when placed everything is absolutely fine. It's just the held icon that I'm having trouble with.
-
Issues with texturing the ItemBlock for my meta Tile Entity
Sorry, I didn't think it would be relevant as it only renders the in-game block, which as I said works fine Here it is anyway: package co.uk.silvania.roads.tileentities.renderers; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import co.uk.silvania.roads.client.models.RoadSlopeModel; import co.uk.silvania.roads.client.models.TrafficLightModel; public class TileEntityTrafficLightRenderer extends TileEntitySpecialRenderer { private TrafficLightModel model; public TileEntityTrafficLightRenderer() { model = new TrafficLightModel(); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { int rotation = 180; switch (te.getBlockMetadata() % 4) { case 0: rotation = 0; break; case 3: rotation = 90; break; case 2: rotation = 180; break; case 1: rotation = 270; break; } GL11.glPushMatrix(); int i = te.getBlockMetadata(); if (i == 0 || i == 1 || i == 2 || i == 3) { Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("roads", "textures/entities/TrafficLightRed.png")); } if (i == 4 || i == 5 || i == 6 || i == 7) { Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("roads", "textures/entities/TrafficLightGreen.png")); } if (i == 8 || i == 9 || i == 10 || i == 11) { Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("roads", "textures/entities/TrafficLightRedAmber.png")); } if (i == 12 || i == 13 || i == 14 || i == 15) { Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("roads", "textures/entities/TrafficLightAmber.png")); } GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.0F, -1F, -1F); model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } }
-
Issues with texturing the ItemBlock for my meta Tile Entity
I have a custom renderer yes. For non-meta blocks, I can just use the normal getIcon method in the block class, it's when I introduce metadata that I get issues. I'm only having trouble with the itemblock. Once it's placed in the world, everything is absolutely fine.
-
Setting Creative Tab
Remove the S from the end of tabs: this.setCreativeTab(blah)
-
Issues with texturing the ItemBlock for my meta Tile Entity
Bump! Still struggling with this.
-
Help with using idPicked?
That didn't work, but pointed me in the right direction. Because my base metas are 0, 4, 8 and 12 your thing didn't work - it was giving me 0-3. Using this worked (for anyone interested) public int damageDropped(int meta) { if (meta == 0 || meta == 1 || meta == 2 || meta == 3) { return 0; } if (meta == 4 || meta == 5 || meta == 6 || meta == 7) { return 4; } if (meta == 8 || meta == 9 || meta == 10 || meta == 11) { return 8; } else return 12; }
-
Help with using idPicked?
Hey guys, I have a metadata-based block, whcih has 4 blocks with 4 different rotations. So, meta 0-3 is block 1 rotation 1-4, meta 4-7 is block 2 rotation 1-4 etc. Now, I want to set it up so I can use the pick block key (middle click) and get block 1 rotation 1 for meta 0-3, block 2 rotation 1 for 4-7 and so on - I don't want to get the extra rotated blocks. Can anyone guide me on how I'd go about doing this? It's one of the last things until I can release the beta of my mod so really want to get it sorted!
-
Redstone Troubles...
Hey guys, Having some issues with a block I'm trying to make. Basically, what it should do is pass on a redstone signal that it receives, in any direction. I don't mind if it refreshes the current or anything, that doesn't really matter. So, in a simple term what I need is "if block is receiving power, emit power". I can't understand why, but I'm having quite a bit of trouble with doing this, so I was hoping someone could help me. I've tried numerous ways, gave up on it for a while but now I'm determined to make it work! The first issue I'm having, is that if I stack the blocks, when I remove the current source, it doesn't turn off the block. I place the block, wire each side. It's off, this is good. I place a redstone torch on one side. Both wires get power, so the block is passing on current as it should. This is also good. If I remove the torch now, the current will turn off, which is good. However, if I place a second pole on top of the block, like so (as this is part of their plan) Then, when I remove the torch, the redstone stays on. How can I set it so when the power source is removed, all the vertical poles are disabled? It's probably something pretty simple but I can't figure it out. Here is my class: package co.uk.silvania.roads.block; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Random; import java.util.Set; import co.uk.silvania.roads.Roads; import net.minecraft.block.Block; import net.minecraft.block.BlockRedstoneWire; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Direction; import net.minecraft.util.ReportedException; import net.minecraft.world.ChunkPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; public class PowerPoleMedium extends Block { private final boolean powered; public static int powerValue; public PowerPoleMedium(int id, boolean par2) { super(id, Material.iron); this.powered = par2; this.setCreativeTab(Roads.tabRoads); this.setBlockBounds(0.45F, 0.0F, 0.45F, 0.55F, 1.0F, 0.55F); } public int getRenderType() { return 0; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { if (this.powered) { return 15; } return 0; } public boolean canProvidePower() { return true; } public void onBlockAdded(World par1World, int par2, int par3, int par4) { if (!par1World.isRemote) { if (this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.setBlock(par2, par3, par4, Roads.powerPole.blockID, 0, 2); } else if (!this.powered && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.setBlock(par2, par3, par4, Roads.powerPoleOn.blockID, 0, 2); } } } public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { if (!par1World.isRemote) { if (this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.setBlock(par2, par3, par4, Roads.powerPole.blockID, 0, 2); } else if (!this.powered && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.setBlock(par2, par3, par4, Roads.powerPoleOn.blockID, 0, 2); } } } public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (!par1World.isRemote && this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { par1World.setBlock(par2, par3, par4, Roads.powerPole.blockID, 0, 2); } } public void registerIcons(IconRegister iconRegister) { blockIcon = iconRegister.registerIcon("Roads:PowerPole"); } } Right now I'm just using two blocks; "on" and "off". Is that the best approach? (Also, if you know a better way of doing this i'm all ears. All the pole needs to do is emit redstone in all directions when powered, and stop emitting when power is removed. I've got it working only horizontally and only vertically before, but never all 6 directions.)
-
Strange NPE which I can't figure out...
Yup, that was it. I knew it'd be something simple like that, I totally forgot to change how my Biomes were created to match the blocks, so they were being loaded first.
-
Strange NPE which I can't figure out...
Hey guys. I'm trying to set up my dimensions. When I first wrote the mod a while back, I had just hardcoded IDs - creating my blocks in the main class looked like this: public final static Block akatoeGrass = new AkatoeGrass(201).setUnlocalizedName("akatoeGrass"); With it like that, my biome works just fine. However, now I want to set up configs for the mod. After I stopped doing this mod (I went on a break from it for a while), I learned about how to make a config file, and so I now do my blocks like this: public static Block akatoeGrass; @EventHandler public void preInit(FMLPreInitializationEvent event) { RemulaConfig.loadConfig(event); RemulaConfig config = new RemulaConfig(); akatoeGrass = new AkatoeGrass(config.akatoeGrassID).setUnlocalizedName("akatoeGrass"); } Doing it that way gives me this error, with a NPE. I can't for the life of me figure out why... Can someone shed some light on the situation? It's probably a really simple error and I'm just missing something, but noone on IRC could help so figured I might as well post here http://pastebin.com/BXa5Ae8A (Line 644 of my Remula class just registers my Biome) Any help is great, sorry if it's a bit of a noobie question but I'm stumped of how I can get configs working without causing an NPE.
-
[UNRESOLVED]Entity rendering in air as Mob colors
You need to update the way you load textures. Take a look in the chest renderer or any mob renderer for how to do so.
-
Trying to place extra blocks with metadata... Not going well.
http://pastebin.com/jB1xJe1W is the code in question. What I want to happen, is depending on the blocks rotation, it should place extra "gag blocks" to fill out some gaps. And, for meta 0, this works brilliantly: However, when I try and place in another direction, I want the blocks to obviously be placed in the correct direction again. But, the extra blocks always go to the same place, like so: Probably some sort of really simple mistake, but can anyone point me in the right direction? Sorry for posting something so trivial, but noone on IRC could help
-
Help with my crafting table?
Anyone? I'm really struggling with this...
-
Help with my crafting table?
Gonna have to bump this. I tried tinkering a little but couldn't get it to work then focused on other things for a little while Here's my updated code, but there's not MUCH different to before. Probably true, I changed it but to no avail. I've fixed that now, didn't change anything
-
Is it possible to render techne model with ISimpleBlockRenderingHandler?
That link works But, Nait did say no tile entities, yours uses a tile entity
-
Is it possible to render techne model with ISimpleBlockRenderingHandler?
Your link doesn't work, but from what I can see of it it's using a TileEntity?
-
Issues with texturing the ItemBlock for my meta Tile Entity
Hey guys, I'm having issues texturing some of the ItemBlocks for my Tile Entites. All my Tile Entities are simply for model renders, nothing fancy. Most of them are just a simple one, and work. However, I have a few cases where I have four different textures for the same render, changed based on meta. These are where I'm having the issue - I'm trying to set a different texture for each of the four ItemBlocks which actually show in creative, but it's only registering the first one (for meta 0). I know they actually work, because they place the correctly textured model in-game. Here's my current Block code: package co.uk.silvania.roads.tileentities.blocks; import java.util.List; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import co.uk.silvania.roads.Roads; import co.uk.silvania.roads.tileentities.entities.TileEntityTrafficLightEntity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class TileEntityTrafficLightBlock extends BlockContainer { public TileEntityTrafficLightBlock(int id) { super(id, Material.iron); this.setHardness(1.0F); this.setCreativeTab(Roads.tabRoads); this.setLightOpacity(0); this.setBlockBounds(0.35F, 0.0F, 0.35F, 0.65F, 0.8F, 0.65F); } @Override public TileEntity createNewTileEntity(World world) { return new TileEntityTrafficLightEntity(); } @Override public int getRenderType() { return -1; } @Override public boolean isOpaqueCube() { return false; } @Override public boolean renderAsNormalBlock() { return false; } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemStack) { int blockSet = world.getBlockMetadata(x, y, z) / 4; int direction = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; int newMeta = (blockSet * 4) + direction; world.setBlockMetadataWithNotify(x, y, z, newMeta, 0); } @SideOnly(Side.CLIENT) private Icon red; @SideOnly(Side.CLIENT) private Icon green; @SideOnly(Side.CLIENT) private Icon redamber; @SideOnly(Side.CLIENT) private Icon amber; @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { red = iconRegister.registerIcon("Roads:trafficLight0"); green = iconRegister.registerIcon("Roads:trafficLight4"); redamber = iconRegister.registerIcon("Roads:trafficLight8"); amber = iconRegister.registerIcon("Roads:trafficLight12"); } @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int meta) { if (meta == 0) { System.out.println("Red!"); return red; } if (meta == 4) { System.out.println("Green!"); return green; } if (meta == { System.out.println("Red/Amber!"); return redamber; } if (meta == 12) { System.out.println("Amber!!"); return amber; } System.out.println("Nothin'!"); return amber; } @SideOnly(Side.CLIENT) public void getSubBlocks(int par1, CreativeTabs creativeTabs, List list) { list.add(new ItemStack(par1, 1, 0)); list.add(new ItemStack(par1, 1, 4)); list.add(new ItemStack(par1, 1, ); list.add(new ItemStack(par1, 1, 12)); } } And here it is in-game. The four traffic lights in my inventory are in order left-right to the ones placed in front of me: I'm happy to either use an icon (as shown) or the IItemRenderer. I tried following another thread a few pages back about using that, but it died without a solution, so wasn't much help really. It's worth noting I'm not using an ItemBlock class for the texturing - as far as I'm aware I don't need to do that. Correct me if I'm wrong? Anyone able to help?
-
[1.6.2] [Solved] Fluid system
Have you got as far as a flowable, animated liquid yet? I've got that bit working. I can't get the bucket working though, let me know if you find anything
-
GUI Button location issue
Hey guys. Just started on the road to making buttons for my GUI, and I've already hit two issues. These are both purely graphical issues, I've not started the functionality yet. Basically, what I want to do is add a total of 21 buttons in my GUI, which do various things. The buttons should be positioned in the GUI and some I want to have a custom shape. So, issue 1: Can I make the buttons a different shape to the square one I'm getting at the moment? And, issue 2: The buttons aren't syncing with the GUI, they're syncing with the screen. So, when I resize my screen, the buttons move differently to how they should. Screenshots: This is full-screen, and it's correct: This is not full screen, and the buttons are now in the wrong place: Here is my code. I don't have any packet/functional stuff yet, I've literally only started on the graphical side of it. @Override public void initGui() { super.initGui(); buttonList.add(new GuiButton(1, 200, 166, 24, 16, "7")); buttonList.add(new GuiButton(2, 200, 190, 24, 16, "4")); buttonList.add(new GuiButton(3, 200, 214, 24, 16, "1")); } Finally, for those who like to count, yes there is 24 buttons on the GUI. Three are just for show and have no use; just like a real ATM.
-
[Not solved but im done.]How to save integers to a file.
I am sorry for returning the favour. And of course I know it's not static. playerINSTANCE means something like: EntityPlayer [i]playerInstance[/i] = new EntityPlayer(); Except you can't do that. So maybe try Minecraft.getMinecraft().thePlayer.username Don't post here again. I've already reported you a moderator. I hope this isn't the way you solve every problem you come by. Heaps of people have posted here trying to help you and you have not been able to get code that they have spent time to write for you to work. The code is especially tailor made for your request. I suggest this: http://docs.oracle.com/javase/tutorial/ [EDIT] And yes, I have been rude to you. And I have no excuses for that. But you have been extremely rude to me and others in the first place. So I am willing to accept my actions and be reprimanded for them. Report away. Why are you still trying to help him? I gave up after the first sour comment to be honest. If he hasn't understood it by now, he never will- between you and maxpowa you pretty much wrote the entire code for him. I'm not exactly good at Java and I managed to get it all working and even release the first alpha of my standalone economy mod which uses it.
-
Using a value from the player NBT as a string in a GUI
I'll eventually need packets with it anyway so I'll probably use the packet method. Eventually I plan to add bukkit support (for people using MCPC+ and BukkitForge), so that players can transfer their balance from this to a bukkit econ and vice versa via a hidden server command. So, at any rate, both the client and server will need it in my setup
-
Is it possible to add my own character to chat?
Hey guys, So, I noticed that in the new resource packs there's now an ascii.png for font drawing etc. This made me wonder; is it possible at all to add my own character? It doesn't neccesarily have to be type-able (After all, it wouldn't be on the keyboard...), but it'd certainly be nice if I can at least print it to chat. If I can somehow let the player type it (maybe ctrl+4 or something when in chat) Not really a massive deal if I can't, just it would be a nice addon for my economy mod if I can make my own currency symbol
-
Not a network mod?
Double-check your capitalization with your instance and your @Network annotation stuff. In my mod I had this issue, and it turned out my modID was flenixroads where as my Network annotation was saying FlenixRoads, and that alone stopped it working
IPS spam blocked by CleanTalk.