Some improvements to render speed of cables
This commit is contained in:
parent
7c56cd25f6
commit
37467cab7e
5 changed files with 21 additions and 19 deletions
|
@ -15,13 +15,12 @@ import uk.co.qmunity.lib.client.render.RenderHelper;
|
|||
public class RenderCablePart {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static boolean renderStatic(Vecs3d translation, RenderHelper renderer, int pass, CablePart part) {
|
||||
renderer.renderBox(ModLib2QLib.convert(part.boundingBoxes[6]), getIconFromType(part.type));
|
||||
if (part.connectedSides != null) {
|
||||
IIcon icon = getIconFromType(part.type);
|
||||
renderer.renderBox(ModLib2QLib.convert(part.boundingBoxes[6]), icon);
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (part.connectedSides.containsKey(dir))
|
||||
renderer.renderBox(ModLib2QLib.convert(part.boundingBoxes[Functions.getIntDirFromDirection(dir)]), getIconFromType(part.type));
|
||||
if (part.connectedSides.get(dir) != null)
|
||||
renderer.renderBox(ModLib2QLib.convert(part.boundingBoxes[Functions.getIntDirFromDirection(dir)]), icon);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -18,13 +18,12 @@ public class ModParts {
|
|||
CablePart part = new CablePart(i);
|
||||
ModPartRegistry.registerPart(part);
|
||||
}
|
||||
ModPartRegistry.addProvider(
|
||||
"techreborn.partSystem.QLib.QModPartFactory", "qmunitylib");
|
||||
//ModPartRegistry.addProvider("techreborn.partSystem.QLib.QModPartFactory", "qmunitylib");
|
||||
ModPartRegistry.addProvider("techreborn.partSystem.fmp.FMPFactory",
|
||||
"ForgeMultipart");
|
||||
ModPartRegistry.addAllPartsToSystems();
|
||||
for(IPartProvider provider : ModPartRegistry.providers){
|
||||
if(provider.modID().equals("qmunitylib")){
|
||||
if(provider.modID().equals("ForgeMultipart")){
|
||||
ModPartRegistry.masterProvider = provider;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,12 +39,14 @@ public class ModPartItem extends Item {
|
|||
try {
|
||||
if(modPart instanceof CablePart){
|
||||
if (ModPartRegistry.masterProvider.placePart(item, player, world, x, y, z, face, x_, y_, z_, modPart.getClass().getDeclaredConstructor(int.class).newInstance(((CablePart) modPart).type))) {
|
||||
player.swingItem();
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
if (ModPartRegistry.masterProvider.placePart(item, player,
|
||||
world, x, y, z, face, x_, y_, z_, modPart.getClass()
|
||||
.newInstance())) {
|
||||
player.swingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +66,8 @@ public class ModPartItem extends Item {
|
|||
if(modPart instanceof CablePart){
|
||||
try {
|
||||
if (partProvider.placePart(item, player, world, x, y, z, face, x_, y_, z_, modPart.getClass().getDeclaredConstructor(int.class).newInstance(((CablePart) modPart).type))) {
|
||||
return true;
|
||||
player.swingItem();
|
||||
return true;
|
||||
}
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -73,7 +76,8 @@ public class ModPartItem extends Item {
|
|||
}
|
||||
} else {
|
||||
if (partProvider.placePart(item, player, world, x, y, z, face, x_, y_, z_, modPart.getClass().newInstance())) {
|
||||
return true;
|
||||
player.swingItem();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ package techreborn.partSystem.fmp;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -25,6 +26,7 @@ import codechicken.multipart.TMultiPart;
|
|||
import codechicken.multipart.TSlottedPart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import uk.co.qmunity.lib.vec.Vec3i;
|
||||
|
||||
public class FMPModPart extends TMultiPart implements TSlottedPart,
|
||||
JNormalOcclusion, ISidedHollowConnect {
|
||||
|
@ -176,12 +178,10 @@ public class FMPModPart extends TMultiPart implements TSlottedPart,
|
|||
|
||||
@Override
|
||||
public boolean renderStatic(Vector3 pos, int pass) {
|
||||
boolean render = false;
|
||||
render = iModPart.renderStatic(new Vecs3d(pos.x, pos.y, pos.z), uk.co.qmunity.lib.client.render.RenderHelper.instance, pass);
|
||||
RenderHelper.instance.resetRenderedSides();
|
||||
RenderHelper.instance.resetTextureRotations();
|
||||
RenderHelper.instance.resetTransformations();
|
||||
RenderHelper.instance.setColor(0xFFFFFF);
|
||||
return 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);
|
||||
RenderHelper.instance.reset();
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ 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.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -131,7 +132,6 @@ public class CablePart extends ModPart implements IEnergyConductor, INetworkTile
|
|||
|
||||
@Override
|
||||
public void renderDynamic(Vecs3d translation, double delta) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue