Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BusyBeever

Members
  • Joined

  • Last visited

Everything posted by BusyBeever

  1. Depends on the case. But imagine, a range of 10 is already 1000 blocks to check.. Yes IDENTIFIER is the DATANAME. But you shouldnt say world.setItemData("MonsterBlock_BlockList",handler). Use the String variable you defined world.setItemData(DATANAME, handler) You call the method and get your handler back, where you can getter methods that return u the list of blocks
  2. Why are you packing everything into a string? Like seriously, pass the 3 arguments as integer
  3. Write a get method for it like that public static MyData get(World world) { MyData handler = (MyData )world.loadItemData(MyData .class, IDENTIFIER); if(handler==null) { handler = new MyData (); world.setItemData(IDENTIFIER, handler); } return handler; } And here is how to use forge events http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and
  4. do you want to do something when the world is loading or when the player is changing dimensions?
  5. 1. dont call readFromNBT urself, minecraft will do that for you. 2. you need to use events to catch a player joining a dimension
  6. MarkDirty() tells minecraft that there have been changes that need to be written to disk when saving the game
  7. dont mine in randomDisplayTick, since it is client only and you need to mine the blocks on server side. You will need a tikcing tile Entity
  8. you can either do it that way or create one NBTTagcompound for each blockpos in the list and save it using a NBTTagList
  9. I think by instanceof TileEntityChest . If you want to know it look inside the Chests classes
  10. The problem isnt your class, the problem is minecrafts class. You can override stuff to prevent minecrafts chest to going into "double-chest mode" when your chest is getting placed second, but I dont think you can prevent it if minecrafts chest gets placed after yours.
  11. oh yeah im dumb. u only need events to modify vanilla behaviour. but still is nearly the same, just using block methods
  12. welcome to pseudo code island, I will beyour guide public void blockAdded(Event event) { if(event.state.getBlock()==myBlock) { CustomWorldData data = CustomWorldData.get(event.world); data.addBlock(event.pos); } } public void blockRemoved(Event event) { if(event.state.getBlock()==myBlock) { CustomWorldData data = CustomWorldData.get(event.world); data.removeBlock(event.pos); } }
  13. I would use WorldSavedData for that. Everytime one of ur blocks get added safe the position in that class. Everytime one of ur blocks get removed remove it from the class. Everytime a mod gets spawned access ur WorldSavedData, iterate over all blocks and check if they are in range to prevent spawning. If there is one block to prevent the spawn, deny the spawning and break the loop
  14. I guess the problem is that you are extending TileEntityChest, and Vanilla is checking for instanceof TileEntityChest to decide if it needs to make that double chest texture. I dont think you can do that by extending TileEntityChest. What I would do is create my own TileEntity and implement all the methods you need
  15. Sadly thats not how tryMoveToXYZ works (If i get it right) This method will only try to find a way to the specific XYZ, and if it cant it will return false Or am I wrong with that? Because the last time I tried to make that work it was returning me false all the time ( because the blocks I wanted him to build were out of range I guess)
  16. Well the point is that it might be that the energy value isnt synced, so waila tells you that the energy is zero (on ur side, client) but on server side it is correct and simply not synchronized with client
  17. at bitevo.Zetal.LoMaS.Specializations.SpecializationsMod.clientStart(SpecializationsMod.java:492) ~[bin/:?] can you show that part of the code? I feel like you should not generate a GuiContainer inside your mod init. It is crashing in your mod init right?
  18. my bad. yeah sorry I had only container in my mind. Nevermind me
  19. A GuiContainer should not be for clients only, since the server also needs them. So maybe you got an problem in the way you designed the code? Maybe show ur guihandler with the crash log
  20. It is pretty straight forward. You need to get the entity you want to kill. Then you call entity.setDead(). How you get the entity depends on how you determine that you want to kill it
  21. Hello everyone, what I am triing to is code an Entity that will construct something (e.g. a building) and im starting to question if my approach is the right one. The information about what he should be building is called the "ConstructionTask", which is storing nothing but an ArrayList of the BlockInformations needed public class ConstructionTask { private ArrayList<BlockInf> blocksToPlace; public ConstructionTask(ArrayList<BlockInf> blocksToPlace) { this.blocksToPlace = blocksToPlace; } public BlockInf getNextBlock(BlockPos myPos) { if(blocksToPlace.size()==0) return null; return blocksToPlace.remove(0); } } public class BlockInf { private final BlockPos pos; private final IBlockState state; public BlockInf(BlockPos pos, IBlockState state) { this.pos = pos; this.state= state; } public BlockPos getPos() { return pos; } public IBlockState getState() { return state; } } First question is it a good idea to store a building that way while constructing it? Now comes the bigger problem. Creating the building. My idea was that the engineer takes the next task from the list, tries to move near the position (e.g. max distance = 3) and then places the block. Problem nr.1 what if there is no position that is close enough to stand on a block and have the desired distance Problem nr.2 if there is such a block, how to find it? If my approach is total bs please tell me, since this part of the project beeing messy can kill the performance of the mod. My first attempt on creating a construction task private class BuildVillageTask extends EntityAIBase { //The task the Engineer is working on private ConstructionTask task; //The next block the Engineer should place private BlockInf nextBlock; public BuildVillageTask() { } @Override public boolean shouldExecute() { //Always execute the task if the home has a new task for us return home.hasConstructionTask(); } @Override public boolean isInterruptible() { //Not interruptable. Maybe change this later return false; } @Override public void startExecuting() { //Get the task from home task = home.getNextConstructionTask(); //Get the first block to place nextBlock = task.getNextBlock(new BlockPos(EntityVillagerCustom.this)); } @Override public boolean continueExecuting() { //If we reached our path if(getNavigator().noPath()) { //What we should do here: //Place the black //Get the next task //Set the navigator path to that place } else { //Do nothing since we are waiting to reach our place } //this will be changed later to "when building is done" return true; } }
  22. DONT use event.getSide. If you want to do stuff and dont got an worldObj to check if you are on client on server side use a SidedProxy

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.