-
Posts
1061 -
Joined
-
Last visited
Everything posted by NovaViper
-
The thing is, all of my entities are using different renderers because they have different skins. And yes, I am using a superclass that of the Zertum types are using called EntityZertumEntity
-
Well, I have this package common.zeroquest.core.proxy; import net.minecraft.block.Block; import net.minecraft.block.BlockFire; import net.minecraft.block.properties.IProperty; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.statemap.StateMap; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import common.zeroquest.ModBlocks; import common.zeroquest.ModItems; import common.zeroquest.block.portal.*; import common.zeroquest.client.model.*; import common.zeroquest.client.particle.*; import common.zeroquest.client.render.*; import common.zeroquest.client.render.entity.RenderJakan; import common.zeroquest.client.render.entity.RenderKortor; import common.zeroquest.client.render.entity.RenderKurr; import common.zeroquest.client.render.entity.RenderProjectiles; import common.zeroquest.client.render.entity.RenderRiggator; import common.zeroquest.client.render.tileentity.RenderFoodBowl; import common.zeroquest.client.render.tileentity.RenderNileTable; import common.zeroquest.client.render.zertum.RenderDarkZertum; import common.zeroquest.client.render.zertum.RenderDestroZertum; import common.zeroquest.client.render.zertum.RenderForisZertum; import common.zeroquest.client.render.zertum.RenderIceZertum; import common.zeroquest.client.render.zertum.RenderMetalZertum; import common.zeroquest.client.render.zertum.RenderRedZertum; import common.zeroquest.client.render.zertum.RenderZertum; import common.zeroquest.client.render.zertum.RenderZinogre; import common.zeroquest.core.handlers.*; import common.zeroquest.entity.*; import common.zeroquest.entity.projectile.*; import common.zeroquest.entity.tileentity.*; import common.zeroquest.entity.zertum.*; import common.zeroquest.entity.zertum.util.*; import common.zeroquest.lib.Constants; public class ClientProxy extends CommonProxy { @Override public void registerRenderThings() { RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); registerRender(EntityZertum.class, new RenderZertum(renderManager, new ModelZertum(), 0.5F)); registerRender(EntityRedZertum.class, new RenderRedZertum(renderManager, new ModelZertum(), 0.5F)); registerRender(EntityDarkZertum.class, new RenderDarkZertum(renderManager, new ModelZertum(), 0.5F)); registerRender(EntityDestroZertum.class, new RenderDestroZertum(renderManager, new ModelZertum(), 0.5F)); registerRender(EntityIceZertum.class, new RenderIceZertum(renderManager, new ModelZertum(), 0.5F)); registerRender(EntityForisZertum.class, new RenderForisZertum(renderManager, new ModelZertum(), 0.5F)); registerRender(EntityMetalZertum.class, new RenderMetalZertum(renderManager, new ModelZertum(), 0.5F)); registerRender(EntityJakan.class, new RenderJakan(renderManager, new ModelJakan(), 1.0F)); registerRender(EntityKurr.class, new RenderKurr(renderManager, new ModelKurr(), 1.0F)); registerRender(EntityKortor.class, new RenderKortor(renderManager, new ModelKortor(), 1.0F)); registerRender(EntityRiggator.class, new RenderRiggator(renderManager, new ModelRiggator(), 1.0F)); registerRender(EntityZinogre.class, new RenderZinogre(renderManager, new ModelZinogre(), 1.0F)); // registerRender(EntityRowarn.class, new RenderRowarn(renderManager, new ModelRowarn(), 1.0F)); registerRender(EntityFlamingPoisonball.class, new RenderProjectiles(renderManager, ModItems.FPoisonball, renderItem)); registerRender(EntityIceball.class, new RenderProjectiles(renderManager, ModItems.iceBall, renderItem)); registerRender(EntityGrenade.class, new RenderProjectiles(renderManager, ModItems.nileGrenade, renderItem)); registerRender(EntityZertumBeam.class, new RenderProjectiles(renderManager, Items.snowball, renderItem)); bindTileEntitySpecialRenderer(TileEntityNileWorkbench.class, new RenderNileTable()); bindTileEntitySpecialRenderer(TileEntityFoodBowl.class, new RenderFoodBowl()); } @Override public void registerMoreThings() { registerKeyBinding(KeyStateHandler.come); registerKeyBinding(KeyStateHandler.stay); registerKeyBinding(KeyStateHandler.ok); registerKeyBinding(KeyStateHandler.heel); registerFMLCommonEventBus(new KeyStateHandler()); } @Override public void registerStateMappings() { addStateMapperToIgnore(ModBlocks.nileFire, BlockNileFire.AGE); addStateMapperToIgnore(ModBlocks.nileFire, BlockFire.AGE); } @Override public void registerStateMappingsForDark() { addStateMapperToIgnore(ModBlocks.darkFire, BlockDarkFire.AGE); addStateMapperToIgnore(ModBlocks.darkFire, BlockFire.AGE); } // Registers\\ public void registerFMLCommonEventBus(Object target) { FMLCommonHandler.instance().bus().register(target); } public void registerKeyBinding(KeyBinding key) { ClientRegistry.registerKeyBinding(key); } public void bindTileEntitySpecialRenderer(Class<? extends TileEntity> tileentity, TileEntitySpecialRenderer render) { ClientRegistry.bindTileEntitySpecialRenderer(tileentity, render); } public void registerRender(Class entityClass, Render render) { RenderingRegistry.registerEntityRenderingHandler(entityClass, render); } public static void addStateMapperToIgnore(Block block, IProperty property) { ModelLoader.setCustomStateMapper(block, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] { property }).build()); } // Client Objects\\ @Override public EntityPlayer getClientPlayer() { return FMLClientHandler.instance().getClientPlayerEntity(); } @Override public void spawnCrit(World world, Entity entity) { FMLClientHandler.instance().getClient().effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT); } @Override public void spawnRoar(World world, Entity entity) { FMLClientHandler.instance().getClient().effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.SPELL_WITCH); FMLClientHandler.instance().getClient().effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT); } public static void spawnForisParticle(EntityCustomTameable entity) { double d0 = entity.getRNG().nextGaussian() * 0.04D; // TODO double d1 = entity.getRNG().nextGaussian() * 0.04D; double d2 = entity.getRNG().nextGaussian() * 0.04D; EntityForisDustFX var20 = new EntityForisDustFX(entity.worldObj, entity.posX + entity.getRNG().nextFloat() * entity.width * 2.0F - entity.width, entity.posY + 0.5D + entity.getRNG().nextFloat() * entity.height, entity.posZ + entity.getRNG().nextFloat() * entity.width * 2.0F - entity.width, d0, d1, d2); for (int i = 0; i < 7; ++i) { FMLClientHandler.instance().getClient().effectRenderer.addEffect(var20); } } public static void spawnIceParticle(Entity entity) { EntityIceDustFX var20 = new EntityIceDustFX(entity.worldObj, entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D); FMLClientHandler.instance().getClient().effectRenderer.addEffect(var20); } public static void spawnDarkParticle(World worldIn, double d0, double d1, double d2, double d3, double d4, double d5) { EntityDarkPortalFX entityFX = new EntityDarkPortalFX(worldIn, d0, d1, d2, d3, d4, d5); FMLClientHandler.instance().getClient().effectRenderer.addEffect(entityFX); } } What I'm trying to do is, and ONLY for the Zertums, add mulitple models for their evolution forms. At first, I had the two forms in one ModelBase class, and now I have 3 forms but in seperate classes since I was told that I can switch ModelBases based on an entity's state
-
And I'm trying to accomplish using multiple models for multiple entities
-
No, I'm looking through the class and it's clearly for block entities.. I don't see any entities that are living ones in the class
-
But it says TileEntity.. my entity isn't a TileEntity
-
It's not for a tile entity, its for a living one
-
Ok.. I'm basically stuck at how to switch between 3 different models based on entity state
-
I started on it but I eventually cut it out because I wasn't really sure if using enums wouldn't allow me to switch between certain things like the health and damage of the entity
-
Wait.. I just got an idea, is it possible to set a entity's type as an enum? The idea is to just scratch out all of the Zertum types I have and just have one class where all of the zertum types are using. And the types can be changed by certain conditions, like say, the type of biome it is in. And these types are enums.
-
And now the main question, how do I get the other 2 models I have in to get called? Only one is getting called so far
-
I did, but on my Client Proxy, it says it has to be a varable, so i changed all the parameters as a class extending to EntityZertumEntity, which caused an error for the subclass check saying it has to be a entity, not a class. And the different subtypes all have different textures and have completely different abilities from the others.
-
I want to render a different model based on the entity's state I don't know how do to do it in the render class, but in the ModelBase class I know how. I tried something like this Render Class package common.zeroquest.client.render; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; import common.zeroquest.client.model.ModelZertum; import common.zeroquest.client.render.layers.LayersZertum; import common.zeroquest.client.render.layers.LayersZertumModel; import common.zeroquest.entity.zertum.EntityDarkZertum; import common.zeroquest.entity.zertum.EntityDestroZertum; import common.zeroquest.entity.zertum.EntityForisZertum; import common.zeroquest.entity.zertum.EntityIceZertum; import common.zeroquest.entity.zertum.EntityMetalZertum; import common.zeroquest.entity.zertum.EntityRedZertum; import common.zeroquest.entity.zertum.EntityZertum; import common.zeroquest.entity.zertum.EntityZertumEntity; import common.zeroquest.lib.Constants; import common.zeroquest.util.ResourceReference; @SideOnly(Side.CLIENT) public class RenderZertumModel extends RenderLiving { private static ModelZertum zertum; public static EntityZertumEntity entity; public RenderZertumModel(RenderManager render, EntityZertumEntity entity, float par1) { super(render, zertum, par1); this.entity = entity; this.addLayer(new LayersZertumModel(this, entity)); } public void func_177135_a(EntityZertumEntity entity, double par1, double par2, double par3, float par4, float par5) { if (entity.isWolfWet()) { float f2 = entity.getBrightness(par5) * entity.getShadingWhileWet(par5); GlStateManager.color(f2, f2, f2); } super.doRender(entity, par1, par2, par3, par4, par5); } protected ResourceLocation getEntityTexture(EntityZertumEntity entity) { if (!entity.hasEvolved()) { if (entity.isTamed()) { return ResourceReference.getZTameSkins(getZertumType()); } else if (entity.isAngry()) { return ResourceReference.getZAngrySkins(getZertumType()); } else if (!entity.isTamed() && !entity.isAngry()) { return ResourceReference.getZWildSkins(getZertumType()); } } else if (entity.hasEvolved()) { if (entity.isTamed()) { return ResourceReference.getZEvoTamekins(getZertumType()); } else if (!entity.isTamed() && !entity.isAngry()) { return ResourceReference.getZEvoWildSkins(getZertumType()); } } return null; } private String getZertumType() { if (entity instanceof EntityZertum) { return ""; } else if (entity instanceof EntityRedZertum) { return "r"; } else if (entity instanceof EntityMetalZertum) { return "m"; } else if (entity instanceof EntityIceZertum) { return "i"; } else if (entity instanceof EntityForisZertum) { return "f"; } else if (entity instanceof EntityDestroZertum) { return "des"; } else if (entity instanceof EntityDarkZertum) { return "d"; } return ""; } @Override public void doRender(EntityLiving entity, double par1, double par2, double par3, float par4, float par5) { this.func_177135_a((EntityZertumEntity) entity, par1, par2, par3, par4, par5); } @Override public void doRender(EntityLivingBase entity, double par1, double par2, double par3, float par4, float par5) { this.func_177135_a((EntityZertumEntity) entity, par1, par2, par3, par4, par5); } @Override protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntityZertumEntity) p_110775_1_); } @Override public void passSpecialRender(EntityLivingBase entityLivingBase, double par1, double par2, double par3) { EntityZertumEntity dog = (EntityZertumEntity) entityLivingBase; if (!dog.getPetName().isEmpty()) { super.passSpecialRender(entityLivingBase, par1, par2, par3); } } @Override protected void renderOffsetLivingLabel(Entity entity, double x, double y, double z, String displayName, float scale, double distanceFromPlayer) { super.renderOffsetLivingLabel(entity, x, y, z, displayName, scale, distanceFromPlayer); EntityZertumEntity dog = (EntityZertumEntity) entity; if (distanceFromPlayer < 100.0D) { y += this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.016666668F * 0.7F; String tip = dog.mode.getMode().getTip(); String label = String.format("%s[%d]", tip, dog.getZertumHunger()); if (dog.isPlayerSleeping()) { this.renderLivingLabel(dog, label, x, y - 0.5D, z, 64, 0.7F); } else { this.renderLivingLabel(dog, label, x, y, z, 64, 0.7F); } } if (distanceFromPlayer < 100.0D) { y += this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.016666668F * 0.5F; if (this.renderManager.livingPlayer.isSneaking()) { EntityLivingBase owner = dog.getOwnerEntity(); if (owner != null) { this.renderLivingLabel(dog, owner.getDisplayName().getUnformattedText(), x, y, z, 5, 0.5F); } else { this.renderLivingLabel(dog, dog.getOwnerName(), x, y, z, 5, 0.5F); } } } } protected void renderLivingLabel(Entity p_147906_1_, String p_147906_2_, double p_147906_3_, double p_147906_5_, double p_147906_7_, int p_147906_9_, float scale) { double d3 = p_147906_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); if (d3 <= p_147906_9_ * p_147906_9_) { FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); float f1 = 0.016666668F * scale; GlStateManager.pushMatrix(); GlStateManager.translate((float) p_147906_3_ + 0.0F, (float) p_147906_5_ + p_147906_1_.height + 0.5F, (float) p_147906_7_); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); byte b0 = 0; if (p_147906_2_.equals("deadmau5")) { b0 = -10; } GlStateManager.disableTexture2D(); worldrenderer.startDrawingQuads(); int j = fontrenderer.getStringWidth(p_147906_2_) / 2; worldrenderer.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); worldrenderer.addVertex(-j - 1, -1 + b0, 0.0D); worldrenderer.addVertex(-j - 1, 8 + b0, 0.0D); worldrenderer.addVertex(j + 1, 8 + b0, 0.0D); worldrenderer.addVertex(j + 1, -1 + b0, 0.0D); tessellator.draw(); GlStateManager.enableTexture2D(); fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, 553648127); GlStateManager.enableDepth(); GlStateManager.depthMask(true); fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, -1); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } } } Layers class package common.zeroquest.client.render.layers; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.EnumDyeColor; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import common.zeroquest.client.render.RenderZertumModel; import common.zeroquest.entity.zertum.EntityDarkZertum; import common.zeroquest.entity.zertum.EntityDestroZertum; import common.zeroquest.entity.zertum.EntityForisZertum; import common.zeroquest.entity.zertum.EntityIceZertum; import common.zeroquest.entity.zertum.EntityMetalZertum; import common.zeroquest.entity.zertum.EntityRedZertum; import common.zeroquest.entity.zertum.EntityZertum; import common.zeroquest.entity.zertum.EntityZertumEntity; import common.zeroquest.lib.Constants; import common.zeroquest.util.ResourceReference; @SideOnly(Side.CLIENT) public class LayersZertumModel implements LayerRenderer { private final RenderZertumModel renderer; public static EntityZertumEntity entity; public LayersZertumModel(RenderZertumModel renderer, EntityZertumEntity entity) { this.renderer = renderer; this.entity = entity; } public void func_177145_a(EntityZertumEntity entity, float par1, float par2, float par3, float par4, float par5, float par6, float par7) { if (!entity.isInvisible()) { if (!entity.hasEvolved()) { if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZLayers("collar")); EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entity.getCollarColor().getMetadata()); float[] afloat = EntitySheep.func_175513_a(enumdyecolor); GlStateManager.color(afloat[0], afloat[1], afloat[2]); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.getHealth() <= Constants.lowHP) { this.renderer.bindTexture(ResourceReference.getZLayers("dying")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.isSaddled()) { this.renderer.bindTexture(ResourceReference.getZLayers("saddle")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.getGender() == true) { if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZMaleTameLayers(getZertumType())); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } else { this.renderer.bindTexture(ResourceReference.getZMaleLayers(getZertumType())); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } } } else if (entity.hasEvolved()) { if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZELayers("collar")); EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entity.getCollarColor().getMetadata()); float[] afloat = EntitySheep.func_175513_a(enumdyecolor); GlStateManager.color(afloat[0], afloat[1], afloat[2]); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.getHealth() <= Constants.lowHP) { this.renderer.bindTexture(ResourceReference.getZELayers("dying")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.isTamed() && entity.isSaddled()) { this.renderer.bindTexture(ResourceReference.getZELayers("saddle")); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } if (entity.getGender() == true) { if (entity.isTamed()) { this.renderer.bindTexture(ResourceReference.getZEMaleLayers(getZertumType())); GlStateManager.color(1f, 1f, 1f); this.renderer.getMainModel().render(entity, par1, par2, par4, par5, par6, par7); } } } } } private String getZertumType() { if (entity instanceof EntityZertum) { return ""; } else if (entity instanceof EntityRedZertum) { return "r"; } else if (entity instanceof EntityMetalZertum) { return "m"; } else if (entity instanceof EntityIceZertum) { return "i"; } else if (entity instanceof EntityForisZertum) { return "f"; } else if (entity instanceof EntityDestroZertum) { return "des"; } else if (entity instanceof EntityDarkZertum) { return "d"; } return ""; } @Override public boolean shouldCombineTextures() { return true; } @Override public void doRenderLayer(EntityLivingBase entity, float par1, float par2, float par3, float par4, float par5, float par6, float par7) { this.func_177145_a((EntityZertumEntity) entity, par1, par2, par3, par4, par5, par6, par7); } } But I can't add the different entity types because I need an entity to get the instance
-
I've been looking around the internet but I haven't seen anyone actually have two different models being rendered.
-
I'm little bit confused but I do understand the steps of the process, so, I put the main model for the constructor first then make an array with the other models?
-
I know, thats what I've been saying. I was trying to ask hoe am I suppose to do it if it expects only one model?
-
I did the first thing you had public RenderZertumModel(RenderManager renderManager, ModelBase... model, float shadowSize) { super(renderManager, model, shadowSize); // other stuff }
-
No, like, I literally can't change the constructor, it won't allow me to public RenderZertumModel(RenderManager render, ModelBase base, float par1) { super(render, base, par1); this.addLayer(new LayersZertum(this)); } It says "Implicit super constructor RenderLiving() is undefined. Must explicitly invoke another constructor"
-
I can't do the arrays since I'm extending to RenderLiving, it won't allow me to add more. Also, my entites have different textures for each subtype
-
Also I forgot to ask, I'm using a boolean method to check if the entity has evolved, I want to use something like isTamed and isAngry, how do I make a method like that?
-
Is it possible for me to make a superclass renderer for all entites that extend to EntityZertumEntity (the superclass for my many types of Zertums that uses the AI from it)? And how do I put in the seperate models in the render class?
-
I want the appearance to switch, the skin doesn't just change, but the entire model changes when the entity is evolved
-
Thanks for trying to help guys! And I have one last question, is it possible to combine 3 models into one model class? I have an entity that can evolve, which changes it's physical appearance entirely every time it evolves (it has 3 forms, the unevolved form, the first stage evolve, and the final form; similar to that game Evolve). I already have 2 models inside the model already but this final form is much, MUCH larger than the other two
-
The first set is the positions, the 8,8,8 are integers, which are the dimensions of the block
-
Oops, I meant integer, not float.
-
I've tried several other programs too and it doesn't allow me to use integers, eclipse says that the addBox only uses floats, not integers