Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Xerus

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by Xerus

  1. Dude i did... BUT I DIDN'T TURN ON MY BRAIN Thanks! I knew it would be a really dumb mistake again...
  2. yes, everything else gets loaded correctly, forgot to say that
  3. I have a block with a jsn file. The texture is working fine but the breaking particles are this purple-black stuff, s not working. This is my json file: { "parent": "block/cube_all", "textures": { "down": "simpleautomation:blocks/farmerflat", "up": "simpleautomation:blocks/farmerflat", "north":"simpleautomation:blocks/farmer", "south":"simpleautomation:blocks/farmer", "west": "simpleautomation:blocks/farmer", "east": "simpleautomation:blocks/farmer" } }
  4. Whenever I try to download something from the Marketplace, I get this error: Problems occurred while performing provisioning operation: java.lang.IllegalArgumentException: Profile id _SELF_ is not registered. at org.eclipse.equinox.internal.p2.director.ProfileChangeRequest.createByProfileId(ProfileChangeRequest.java:46) at org.eclipse.equinox.p2.operations.InstallOperation.computeProfileChangeRequest(InstallOperation.java:74) at org.eclipse.equinox.p2.operations.ProfileChangeOperation.makeResolveJob(ProfileChangeOperation.java:165) at org.eclipse.equinox.p2.operations.ProfileChangeOperation.resolveModal(ProfileChangeOperation.java:113) at org.eclipse.epp.internal.mpc.ui.operations.ProfileChangeOperationComputer.resolveModal(ProfileChangeOperationComputer.java:378) at org.eclipse.epp.internal.mpc.ui.operations.ProfileChangeOperationComputer.resolve(ProfileChangeOperationComputer.java:367) at org.eclipse.epp.internal.mpc.ui.operations.ProfileChangeOperationComputer.resolveInstall(ProfileChangeOperationComputer.java:279) at org.eclipse.epp.internal.mpc.ui.operations.ProfileChangeOperationComputer.run(ProfileChangeOperationComputer.java:177) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
  5. when it is writing it prints out the correct UUID, and then when I look into the Chunk Data into the TE NBT with NBTExplorer it is saved there. When I put this System.out.println(nbt.hasKey("owner")); into the readFromNBT method, it always returns false...
  6. I am trying to save the UUID of a player to the NBT Data of a TileEntity, and it writes it(I even checked it with NBTExplorer), but it doesn't load it on startup of the world. All other NBT Data loads in correctly. My Tileentity public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); if(!name.equals("bulkcore")) writeItems(nbt); writeKeys(nbt); return nbt; } void writeKeys(NBTTagCompound nbt){ if(name!="bulkcore") writeItems(nbt); if(owner!=null) nbt.setUniqueId("owner",owner); nbt.setBoolean("locked",locked); System.out.println(nbt.getUniqueId("owner")); if (this.hasCustomName()) nbt.setString("CustomName", this.getCustomName()); for(int i=0;i<keys.length;i++){ nbt.setInteger(keys[i],this.getField(i)); } } public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); if(nbt.hasKey("owner")){ this.owner=nbt.getUniqueId("owner"); if(nbt.hasKey("locked")) this.locked=nbt.getBoolean("locked"); } if(nbt.hasKey("CustomName")) this.setCustomName(nbt.getString("CustomName")); for(int i=0;i<keys.length;i++){ String key=keys[i]; if(nbt.hasKey(key)) this.setField(i,nbt.getInteger(key)); } NBTTagList list = nbt.getTagList("Items", 10); for (int i = 0; i < list.tagCount(); ++i) { NBTTagCompound stackTag = list.getCompoundTagAt(i); int slot = stackTag.getByte("Slot") & 255; this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag)); } }
  7. 1. Read more careful pls. the ByteBuf functions were commented out. 2. WHY does it work if i replace setInt and getInt with writeInt and readInt? Anyway, thanks!
  8. I made a scrollable container via handleMouseInput(), but the problem is, that the Server container doesnt know that I have scrolled, sending the wrong inventoryItemstacks to the client Container, creating Ghost Stacks. Now I tried to make it via a SimpleNetworkWrapper and followed Diesiebens tutorial but the Server always receives an EmptyByteBuf... Gui: private int currentScroll; @Override public void handleMouseInput() throws IOException { super.handleMouseInput(); int i = Mouse.getEventDWheel(); //int m = Mouse.getEventButton(); if(i!=0&&this.needsScrollBars()) scroll(i); } private void scroll(int wheel){ wheel=wheel>0?1:-1; currentScroll=util.cap(currentScroll-wheel,0,terows()-5); container().scrollTo(currentScroll); main.network.sendToServer(new Message(currentScroll)); } Container: int scrolled=0; public void scrollTo(int scroll) { scrolled=scroll; for (int y=0;y<5;++y) { for (int x=0;x<9;++x) { this.addSlotToContainer(new Slot(te,x+(y+scroll)*9,8+x*18,18+y*18),x+y*9); } } } private void addSlotToContainer(Slot slot,int pos){ slot.slotNumber=pos; this.inventorySlots.set(pos,slot); this.inventoryItemStacks.set(pos,(ItemStack)null); } Message: public class Message implements IMessage { private int scroll; public Message(){ } public Message(int scroll){ this.scroll=scroll; } @Override public void fromBytes(ByteBuf buf) { if(!(buf instanceof EmptyByteBuf)) scroll=buf.getInt(0); //scroll=Integer.getInteger(ByteBufUtils.readUTF8String(buf)); } @Override public void toBytes(ByteBuf buf) { buf.setInt(0,scroll); //ByteBufUtils.writeUTF8String(buf,Integer.toString(scroll)); } public static class Handler implements IMessageHandler<Message, IMessage>{ @Override public IMessage onMessage(final Message message, MessageContext ctx) { IThreadListener main=(WorldServer)ctx.getServerHandler().playerEntity.worldObj; final Container c=ctx.getServerHandler().playerEntity.openContainer; if(c!=null && c instanceof BulkContainer) main.addScheduledTask(new Runnable(){ public void run() { //((BulkContainer)c).scrollTo(message.scroll); } }); return null; } } }
  9. Read the whole post please. I already did this and a new problem popped up
  10. yes i am just for completeness my gui class: public class FarmerGui extends BaseGui { public FarmerGui(IInventory playerInv, TEInventory te) { super(new FarmerContainer(playerInv, te), playerInv, te); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { drawBackgroundImage("farmer"); // fuel blueprint if(te.getStackInSlot(0)==null) this.drawRect(26, 45, 176, 0, 16, 16); // seeds blueprint for(int i=1;i-1<te.getField(te.getFieldCount()-1);i++) if(te.getStackInSlot(i)==null) this.drawRect(44+18*i, 45, 176, 16, 16, 16); // progress bar int progress=te.getField(0)>0?12-(te.getField(0)*12/te.getField(1)):14; this.drawRect(26, 28+progress, 176, 32+progress, 14, 14-progress); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); // temporary debug output drawString("Fuel: "+te.getField(0)+"/"+te.getField(1), 2, 2); } }
  11. you know what I am asking myself at the moment? Look at the screenshots and then what you said and see the nonsense
  12. it can be, and that is intended, but it isnt and it cant be the problem since update() only performs on server side since I check for worldObj.isRemote
  13. Here you go: public class FarmerTE extends TEInventory implements ITickable,ISidedInventory { int fuel; int lastfuel; int yoffset; private static int rowslots=5; public FarmerTE() { super("farmer",rowslots*2+1,new String[]{"fuel","lastfuel","yoffset"}); fuel=0; lastfuel=1; yoffset=-1; } private int delay=2; @Override public void update(){ if(worldObj.isRemote) return; if(delay>0){ delay--; return; } delay=5; BlockPos position=nextpos(); Block b=util.blockat(worldObj,position); if(b!=null){ // entferne hohes Gras if(util.blockat(worldObj, position.up()).equals(Blocks.TALLGRASS)) worldObj.setBlockState(position.up(),Blocks.AIR.getDefaultState()); // erde zu farmland if((b.equals(Blocks.DIRT)||b.equals(Blocks.GRASS))&&util.blockat(worldObj, position.up()).equals(Blocks.AIR)&&useFuel()){ worldObj.playSound(null, position, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F); if(!worldObj.isRemote) worldObj.setBlockState(position, Blocks.FARMLAND.getDefaultState(), 11); } // pflanzen/ernten Block s=util.blockat(worldObj,position.up()); if(s.equals(Blocks.AIR)){ plant(position); } else if(s instanceof BlockCrops){ if(((BlockCrops)s).isMaxAge(worldObj.getBlockState(position.up()))&&useFuel()) harvest(position,s); } else if(s instanceof BlockNetherWart){ if(worldObj.getBlockState(position.up()).getValue(BlockNetherWart.AGE).intValue()>=3&&useFuel()) harvest(position,s); } } } private void plant(BlockPos position){ for(int slot=1;slot<rowslots+1;slot++){ ItemStack stack=this.getStackInSlot(slot); if(stack!=null&&isplantable(stack)){ IPlantable item=(IPlantable)stack.getItem(); if(util.blockat(worldObj,position).canSustainPlant(worldObj.getBlockState(position),worldObj,position,EnumFacing.UP,item)&&useFuel()){ worldObj.setBlockState(position.up(),item.getPlant(null, null)); decrStackSize(slot,1); return; } } } } private void harvest(BlockPos position,Block plant){ java.util.List<ItemStack> items=plant.getDrops(worldObj, position.up(), worldObj.getBlockState(position.up()), 0); for(ItemStack stack : items){ int start=rowslots+1; if(isplantable(stack)) start=1; for(int slot=start;slot<getSizeInventory();slot++){ ItemStack content=getStackInSlot(slot); if(content==null){ setInventorySlotContents(slot,stack); break; } else if(content.getItem().equals(stack.getItem())){ if(content.stackSize+stack.stackSize<=64){ content.stackSize+=stack.stackSize; setInventorySlotContents(slot,content); break; } else { stack.stackSize-=64-content.stackSize; content.stackSize=64; setInventorySlotContents(slot,content); } } } } worldObj.setBlockToAir(position.up()); plant(position); } private boolean isplantable(ItemStack stack){ return stack.getItem() instanceof IPlantable; } private boolean useFuel(){ int fuelPerOperation=50; if(fuel<fuelPerOperation){ if(getStackInSlot(0)!=null&&TileEntityFurnace.isItemFuel(getStackInSlot(0))){ lastfuel=TileEntityFurnace.getItemBurnTime(getStackInSlot(0)); fuel+=lastfuel; decrStackSize(0,1); } } if(fuel>=fuelPerOperation){ fuel-=fuelPerOperation; return true; } return false; } private int[][] get=new int[][]{{-1,-1,-1,0,1,1,1,0},{-1,0,1,1,1,0,-1,-1}}; private int currentblock=0; private BlockPos nextpos(){ if(currentblock==7) currentblock=0; else currentblock++; return pos.add(get[0][currentblock],0-yoffset,get[1][currentblock]); } @Override public boolean isItemValidForSlot(int index, ItemStack stack) { if(index==0&&TileEntityFurnace.isItemFuel(stack)) return true; if(index>0&&index<rowslots+1&&isplantable(stack)) return true; return false; } @Override public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) { return isItemValidForSlot(index, stack); } @Override public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { if(index>rowslots) return true; return false; } @Override public int[] getSlotsForFace(EnumFacing side) { return new int[]{0,1,2,3,4,5,6,7,8,9,10}; } @Override public int getField(int id) { switch (id){ case 0: return this.fuel; case 1: return this.lastfuel; case 2: return this.yoffset; case 3: return this.rowslots; } throw new RuntimeException("field "+id+" not found"); } @Override public void setField(int id, int value) { switch (id){ case 0: fuel=value; case 1: lastfuel=value; case 2: yoffset=value; } } @Override public int getFieldCount() { return 4; } }
  14. Maybe I could force the container from my tileentity to send an update shortly after I change the fuel value?
  15. apart from the constructor, yes if you want it: nothing fancy
  16. get/setfield: @Animefan I already had it but it changed nothing. Do you even know what i does?
  17. Ok well now I implemented this into my container: the really weird thing is, when the variable in field 0(fuel) changes and the gui is open, it kinda sets lastfuelvalue to fuel(what I dont want), but when i reopen the gui the packet is send again and it gets displayed correct. maybe i didnt explain it good but I just dont understand what mc is doing here... lemme show pictures: just want to remind: this ONLY happened after i added all this listening stuff!
  18. Problem 1 is solved: In short, i needed to send Server information to the client while i had an Container open - A quick look into ContainerFurnace showed the solution, using detectAndSendChanges() After implementing this, a new problem occured. Go 2 posts down to look at it. Ok I now solved the issue by simply introducing a new value for the gui and only changing it if the values from the tileentity for lastfuel and fuel are different: int lastfuel; @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { if(te.getField(1)!=te.getField(0)) lastfuel=te.getField(1); ... } still wondering how the problem occured tho
  19. Ok Thanks getUpdateTag solved it! (how) can i put a [solved] in the topic name?
  20. well if that is how it's supposed to work, then why is the client receiving an NBTTagCompound with the same keys as the server but the value 0?
  21. I am having some really annoying difficultied with my Tileentity, and now I've found the problem: writetonbt() is only called on server side, while readfromnbt() is called on both server and client, and this is just making madness. Have been sitting here for 2 hours trying to find a solution... notice these sysout commands? the console outputs of these: [21:06:09] [server thread/INFO] [sTDOUT]: [com.xerus.simpleautomation.te.TEInventory:readFromNBT:77]: fuel read to 50 [21:06:15] [Client thread/INFO] [sTDOUT]: [com.xerus.simpleautomation.te.TEInventory:readFromNBT:77]: fuel read to 0 ... [21:07:06] [server thread/INFO] [sTDOUT]: [com.xerus.simpleautomation.te.TEInventory:writeToNBT:59]: fuel written to 50 and now my gui displays the client value while my tileentity is using a bit of both...
  22. I want to setup gradle portable but when I try to run it offline by gradlew eclipse --offline (yes i ran it online before and I have the .gradle folder) the following problem occurs. Can I fix it by moving a file somewhere? A problem occurred configuring root project 'SimpleAutomation'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT. Required by: :SimpleAutomation:unspecified > No cached version of net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT available for offline mode. What I know: This is a dependency by build.gradle(line 11) This file exists at GRADLE_USER_HOME\caches\modules-2\files-2.1\net.minecraftforge.gradle\ForgeGradle\2.2-SNAPSHOT
  23. Ok i was just dumb and registered the Superclass as this Block SOLVED
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.