Posted August 5, 201213 yr Can somebody explain (without making me look at MC's source, as I don't understand any of it), what I need to do to make my robot entity move around and have an inventory/gui/container/whatever? I can just about do the rest, and if I can't, I'll just make something up. package net.minecraft.src.GreenEnergy.Solar.Bot; import net.minecraft.src.EntityAIWander; import net.minecraft.src.EntityCreature; import net.minecraft.src.EntityPlayer; import net.minecraft.src.IInventory; import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.World; import net.minecraft.src.universalelectricity.extend.IDisableable; public class EntitySolarBot extends EntityCreature implements IInventory, IDisableable{ private float moveSpeed; private int batteryRemaining; private ItemStack[] containingItems = new ItemStack[2]; private int disableTimer = 0; private int updateTimer = 0; public EntitySolarBot(World par1World) { super(par1World); this.setSize(0.6F, 0.5F); this.moveSpeed = 0.125F; this.tasks.addTask(0, new EntityAIWander(this, this.moveSpeed)); this.batteryRemaining = 0; } @Override protected void entityInit() { if(this.worldObj.canBlockSeeTheSky((int)this.lastTickPosX, (int) this.lastTickPosY, (int) this.lastTickPosZ)){ this.batteryRemaining += 40; this.onDisable(40); } } protected boolean isAIEnabled() { return true; } public void onEntityUpdate(){ if(this.worldObj.canBlockSeeTheSky((int)this.lastTickPosX, (int) this.lastTickPosY, (int) this.lastTickPosZ) && !this.isDisabled()){ chargeElectricalItem(); } this.batteryRemaining--; } private void chargeElectricalItem() { // TODO Auto-generated method stub } @Override public void readEntityFromNBT(NBTTagCompound var1) { } @Override public void writeEntityToNBT(NBTTagCompound var1) { } @Override public int getSizeInventory() { return 2; } public ItemStack getStackInSlot(int par1) { return this.containingItems[par1]; } @Override public ItemStack decrStackSize(int par1, int par2) { if (this.containingItems[par1] != null) { ItemStack var3; if (this.containingItems[par1].stackSize <= par2) { var3 = this.containingItems[par1]; this.containingItems[par1] = null; return var3; } else { var3 = this.containingItems[par1].splitStack(par2); if (this.containingItems[par1].stackSize == 0) { this.containingItems[par1] = null; } return var3; } } else { return null; } } @Override public ItemStack getStackInSlotOnClosing(int par1) { if (this.containingItems [par1] != null) { ItemStack var2 = this.containingItems[par1]; this.containingItems[par1] = null; return var2; } else { return null; } } @Override public void setInventorySlotContents(int var1, ItemStack var2) { // TODO Auto-generated method stub } @Override public String getInvName() { return "Battery Bot"; } @Override public int getInventoryStackLimit() { // TODO Auto-generated method stub return 0; } @Override public void onInventoryChanged() { // TODO Auto-generated method stub } @Override public boolean isUseableByPlayer(EntityPlayer var1) { return true; } @Override public void openChest() { // TODO Auto-generated method stub } @Override public void closeChest() { } @Override public int getMaxHealth() { return 6; } @Override public void onDisable(int duration) { this.disableTimer += duration; } @Override public boolean isDisabled() { return disableTimer == 0; } @Override public boolean isMovementCeased(){ return this.isDisabled() && (this.batteryRemaining != 0); } } So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
August 5, 201213 yr You need to understand the MC source code to be able to code in the MC source code.
August 5, 201213 yr Author Well, I get most of it. I just don't understand entities much. Am I doing it right so far? So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
August 6, 201213 yr Author Just roam around and do the solar panel physics to charge batteries. How would I do the opening of a gui from an entity? Would it be in an entityActivated()? So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
August 6, 201213 yr Just roam around and do the solar panel physics to charge batteries. How would I do the opening of a gui from an entity? Would it be in an entityActivated()? Copy and paste the AI from some mobs to make it wander. http://calclavia.com/uploads/banner.png[/img]
August 6, 201213 yr Just roam around and do the solar panel physics to charge batteries. How would I do the opening of a gui from an entity? Would it be in an entityActivated()? Have you tried decompiling 1.3? The code obviously won't be directly copy/pasteable, but Villagers now open a GUI with a Container.
August 6, 201213 yr Just roam around and do the solar panel physics to charge batteries. How would I do the opening of a gui from an entity? Would it be in an entityActivated()? Have you tried decompiling 1.3? The code obviously won't be directly copy/pasteable, but Villagers now open a GUI with a Container. I retried putting UE into there and I just ran into tons of errors messages. Also, 1.3 seems to have world.isRemote and I think that variable is pretty useless considering the fact that it's ALWAYS remote/SMP? http://calclavia.com/uploads/banner.png[/img]
August 6, 201213 yr Just roam around and do the solar panel physics to charge batteries. How would I do the opening of a gui from an entity? Would it be in an entityActivated()? Have you tried decompiling 1.3? The code obviously won't be directly copy/pasteable, but Villagers now open a GUI with a Container. I retried putting UE into there and I just ran into tons of errors messages. Also, 1.3 seems to have world.isRemote and I think that variable is pretty useless considering the fact that it's ALWAYS remote/SMP? Actually, as I predicted, Mojang didn't come through with the SSP/SMP merger. Instead of the client being a dummy, they just made the client speak in Packetese. By that, I mean all communication in SSP is now dealt through packets. This means the client can now function as an SMP server, but it doesn't actually make SSP mods SMP like we we were promised/lead to assume.
August 6, 201213 yr Actually they never said SSP mods would be SMP capable (which would be impossible without logic in the mod to know on which side to run on), rather they said that SMP mods would be SSP capable, which is true.
August 6, 201213 yr Author Actually they never said SSP mods would be SMP capable (which would be impossible without logic in the mod to know on which side to run on), rather they said that SMP mods would be SSP capable, which is true. So I have to write a SSP and SMP?!?! So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
August 6, 201213 yr Actually they never said SSP mods would be SMP capable (which would be impossible without logic in the mod to know on which side to run on), rather they said that SMP mods would be SSP capable, which is true. So I have to write a SSP and SMP?!?! Yup. Both in minecraft.jar clent http://calclavia.com/uploads/banner.png[/img]
August 6, 201213 yr Author Actually they never said SSP mods would be SMP capable (which would be impossible without logic in the mod to know on which side to run on), rather they said that SMP mods would be SSP capable, which is true. So I have to write a SSP and SMP?!?! Yup. Both in minecraft.jar clent Is it easy? Is there some secret? What needs to change from server to client? So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
August 7, 201213 yr Actually you write just SMP, the SSP part is the SMP part + graphical stuff now. Unlike before where they were two different code basis. So yes, it is a lot easier.
August 7, 201213 yr Author Actually you write just SMP, the SSP part is the SMP part + graphical stuff now. Unlike before where they were two different code basis. So yes, it is a lot easier. Oh. So no weird packet sending/recieving? Or do I just do the sending? So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
August 7, 201213 yr You gotta handle both, same in single player now. Single player 'is' just multi-player, but with a single person.
August 7, 201213 yr Author You gotta handle both, same in single player now. Single player 'is' just multi-player, but with a single person. Yeah. OK. So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.