Jump to content

Recommended Posts

Posted

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. :P

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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. :D

 

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?

Posted

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. :D

 

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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