Xerus
Members-
Posts
35 -
Joined
-
Last visited
Converted
-
Gender
Male
-
Location
Germany
-
Personal Text
Creating Bugs...
Xerus's Achievements
Tree Puncher (2/8)
1
Reputation
-
Dude i did... BUT I DIDN'T TURN ON MY BRAIN Thanks! I knew it would be a really dumb mistake again...
-
yes, everything else gets loaded correctly, forgot to say that
-
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" } }
-
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)
-
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...
-
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)); } }
-
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!
-
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; } } }
-
[Solved but weird] TileEntity Client and Server doing unsynchronized stuff
Xerus replied to Xerus's topic in Modder Support
Read the whole post please. I already did this and a new problem popped up -
[Solved but weird] TileEntity Client and Server doing unsynchronized stuff
Xerus replied to Xerus's topic in Modder Support
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); } } -
[Solved but weird] TileEntity Client and Server doing unsynchronized stuff
Xerus replied to Xerus's topic in Modder Support
you know what I am asking myself at the moment? Look at the screenshots and then what you said and see the nonsense -
[Solved but weird] TileEntity Client and Server doing unsynchronized stuff
Xerus replied to Xerus's topic in Modder Support
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 -
[Solved but weird] TileEntity Client and Server doing unsynchronized stuff
Xerus replied to Xerus's topic in Modder Support
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; } } -
[Solved but weird] TileEntity Client and Server doing unsynchronized stuff
Xerus replied to Xerus's topic in Modder Support
Maybe I could force the container from my tileentity to send an update shortly after I change the fuel value? -
[Solved but weird] TileEntity Client and Server doing unsynchronized stuff
Xerus replied to Xerus's topic in Modder Support
apart from the constructor, yes if you want it: nothing fancy