Jump to content

ovikk

Forge Modder
  • Posts

    97
  • Joined

  • Last visited

Everything posted by ovikk

  1. Yeah, that makes sense. I thought about doing it chunkwise, but I was unsure how to add and modify variables in the chunck without ASM, which I'm trying to avoid. Any ideas on how to do this?
  2. Okay, here's the deal: I want to add a kind of atmosphere to my mod. I created a class called Atmosphere and made it store a list of the different gases. The gases are also a custom class I made, kind of like a Block. I tried storing the Atmosphere value on a per dimension basis, but I found out it was unrealistic and it didn't fit my needs. I wanted to make the gases spread out for their sources, and combine with the other gases in the atmosphere. This could easily be done by adding the an Atmosphere instance in every single air block, but as there are a bunch of air blocks in the world, this will create a huge bunch of lag. I then thought of another way, as explained in the post above, that would reduce the lag a bit, but still create some. As for the amount of gases: probably at least 20 different. Now the question is; do you have a better way, or is this the most efficient, best way of doing it?
  3. I found out I can add a new BlockGas and add a TileEntity to that, and add a function for getting gases out of BlockAir.. But that could still potentially be a lag issue? Any other ideas would be fantastic, but if not, I'd stick to the BlockGas idea.
  4. Okay It will probably fix the issue
  5. wow... Anyway, what's your current problem?
  6. Well, that works.. But I'd really recommend making the MODID lowercase, as it will save you the time and tears when you forget to put it to lowercase. Give me one good reason for having an uppercase.
  7. Dunno if this helps, but MODID must be lowercase..
  8. I've had some problems with this in the past, so I now what made it work for me... In your container class, you need to override some specific functions: void addCraftingToCrafters(ICrafting icrafting) void detectAndSendChanges() void updateProgressBar(int slot, int newValue) If you look in minecrafts ContainerFurnace class, you'll se that the furnace overrites these functions. All you have to do, is do the exactly the same with your Power variable. The slot variable in the updateProgressBar function have nothing to do with the item slots, at least in my experience.
  9. Hello, I would like some advice.. I want to add a variable to BlockAir of type Atmosphere, it's a custom class I have made. Basicly the block is going to store a bunch of gases. I know I could add a substitusion alias for the air block, and make my air block be a tileentity, but that would cause serious lag issues. I know I could also created tons of different blockstates in multiple blocks, but that would take too much time. Any ideas on a better way? I am really stuck...
  10. Could you show us your container? All the magic power displaying happens there. In your updateEntity() in your tileentity, most of that code should happen on the server.
  11. Well that makes sense.. @OP, why do you need to call code when a local game closes?
  12. So, when you shift click an item, the code doesn't run?
  13. What? I thoght the OP wanted his code to run when the world stops, not when it starts...
  14. code? oops.. diesieben07 posted just before me...
  15. Correct me if I'm wrong.. But there is a fml life cycle event called FMLServerStoppedEvent. You would call it like this in the main class: @EventHandler public void serverStopped(FMLServerStoppedEvent event) { //code in here } If that runs just to late, you could also try the FMLServerStoppingEvent.
  16. Oh, well that explains why it is not working... If you copied the BlockPortal class, you'll find that there is a variable called AXIS i your class. If there isn't, add this code to your class: public static final PropertyEnum AXIS = PropertyEnum.create("axis", EnumFacing.Axis.class, new EnumFacing.Axis[] {EnumFacing.Axis.X, EnumFacing.Axis.Z}); This will add facing to your block. Then when you set the block state, you type this: To place a block with facing you need to add withProperty() when getting the IBlockState: getDefaultState().withProperty(YOURBLOCKCLASS.AXIS, THEFACING) The first argument in the withProperty function is the property you wish to change. Since we made the property static, we can easily access it. The second argument is the axis the block should be facing. It can either be X or Z. We change this with: EnumFacing.Axis.Z //will face in Z axis EnumFacing.Axis.X //will face in X axis So for blocks facing X the function would be: world.setBlockState(pos, CustomBlocks.portal.getDefaultState().withProperty(yourblockclass.AXIS, EnumFacing.Axis.X For Z it would be the same, except for the fact that the axis should be Z. Feel free to comment if something was unclear.
  17. Does the portal block have a facing direction, or is it a full block like dirt?
  18. First of all, sorry for the late answer, but here it is! Everything is just fine, except this: world.getBlockState(pos).equals(Blocks.stone) The getBlockState function returns the state the block it is. Kind of the block and the metadata in one class. To get the actual block for comparing you need to add .getBlock() add the end. Like this: world.getBlockState(pos).getBlock() == Blocks.stone This will compare the block in the IBlockState with the block instance in the Blocks class. If this was unclear, feel free to say so. I'll just update this post.
  19. Just open cmd in the folder and write: gradlew setupDecompWorkspace eclipse --refesh-dependencies No need to mess with .bat files. You only need to run the gradlew command once..
  20. Debug it. Take a look at where the content should have been added and find out why it isn't being added. This method is slow, but it alwayes works in the end.
  21. So you want a timer, so that the block will disappear later? Create your a Runnable instance where your timer will countdown. This will make sure that the server doesn't freeze when counting down
  22. Here's my old code that will probably be what you are looking for, its basiclly my version of a Fire Spell: @Override protected void onImpact(MovingObjectPosition mop) { if (mop.typeOfHit == mop.typeOfHit.ENTITY) { if (mop.entityHit != null) { if (mop.entityHit instanceof EntityLiving) { mop.entityHit.attackEntityFrom(DamageSource.onFire, 10F); } } } else if (mop.typeOfHit == mop.typeOfHit.BLOCK) { this.worldObj.setBlock((int) this.posX, (int) this.posY, (int) this.posZ, Blocks.air); } this.setDead(); }
  23. You know you could just extend EntityThrowable and @Override the functions from there? It would be nicer, unless your Entity has some extra key features that EntityThrowable doesn't have.
  24. Stil trying to figure it out but: if (cooktime >= 200) { do something with inventory slots } What if the inventory slots are null? Always check if they are null. Could you post the block, gui, container, and guiHandler classes please? That would speed things up a bit..
×
×
  • Create New...

Important Information

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