Fixes #53, fixed some render things

This commit is contained in:
modmuss50 2015-06-26 13:35:07 +01:00
parent 5fc5aa1e05
commit 15c3608c6e
4 changed files with 24 additions and 12 deletions

View file

@ -27,11 +27,5 @@ public class ModParts {
ModPartRegistry.masterProvider = provider;
}
}
for (int i = 0; i < 13; i++) {
Item stack = ModPartRegistry.itemParts.get("Cable." + i);
if(stack != null){
stackCable.put(i, new ItemStack(stack));
}
}
}
}

View file

@ -45,6 +45,8 @@ public class ModPartRegistry {
itemParts.put(modPart.getName(), part);
if(modPart instanceof CablePart){
GameRegistry.addShapelessRecipe(new ItemStack(part), IC2Items.getItem(CablePart.getTextureNameFromType(((CablePart) modPart).type)));
((CablePart) modPart).stack = new ItemStack(part);
ModParts.stackCable.put(((CablePart) modPart).type, new ItemStack(part));
}
}

View file

@ -9,12 +9,14 @@ import java.util.List;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import techreborn.lib.Location;
import techreborn.lib.vecmath.Vecs3d;
import techreborn.lib.vecmath.Vecs3dCube;
import techreborn.partSystem.ModPart;
import techreborn.util.LogHelper;
import uk.co.qmunity.lib.client.render.RenderHelper;
import codechicken.lib.raytracer.IndexedCuboid6;
import codechicken.lib.vec.Cuboid6;
@ -178,10 +180,23 @@ public class FMPModPart extends TMultiPart implements TSlottedPart,
@Override
public boolean renderStatic(Vector3 pos, int pass) {
boolean render;
RenderHelper.instance.setRenderCoords(getWorld(), (int) pos.x, (int) pos.y, (int) pos.z);
iModPart.renderStatic(new Vecs3d((int) pos.x, (int) pos.y, (int) pos.z), RenderHelper.instance, pass);
render = iModPart.renderStatic(new Vecs3d((int) pos.x, (int) pos.y, (int) pos.z), RenderHelper.instance, pass);
RenderHelper.instance.reset();
return false;
return render;
}
@Override
public Iterable<ItemStack> getDrops() {
List<ItemStack> stackArrayList = new ArrayList<ItemStack>();
if(iModPart.getItem() != null){
stackArrayList.add(iModPart.getItem());
} else {
LogHelper.error("Part " + iModPart.getName() + " has a null drop");
}
return stackArrayList;
}
}

View file

@ -15,9 +15,8 @@ import java.util.Map;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.core.network.NetworkManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -25,6 +24,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import techreborn.client.render.RenderCablePart;
import techreborn.init.ModParts;
import techreborn.lib.Functions;
import techreborn.lib.vecmath.Vecs3d;
import techreborn.lib.vecmath.Vecs3dCube;
@ -41,6 +41,7 @@ public class CablePart extends ModPart implements IEnergyConductor, INetworkTile
protected ForgeDirection[] dirs = ForgeDirection.values();
private boolean[] connections = new boolean[6];
public boolean addedToEnergyNet = false;
public ItemStack stack;
public int type = 0;//TODO save this to nbt and not use the constructor.
@ -194,7 +195,7 @@ public class CablePart extends ModPart implements IEnergyConductor, INetworkTile
@Override
public ItemStack getItem() {
return new ItemStack(ModPartUtils.getItemForPart(getName()));
return ModParts.stackCable.get(type);
}
public boolean shouldConnectTo(TileEntity entity, ForgeDirection dir) {