Texture Rendering for cables
This commit is contained in:
parent
4000dbcc55
commit
1e24d1f116
4 changed files with 24 additions and 14 deletions
|
@ -1,7 +1,9 @@
|
|||
package techreborn.client.render.parts;
|
||||
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -20,7 +22,15 @@ public class ClientPartModelBakery {
|
|||
for(EnumCableType type : EnumCableType.values()){
|
||||
event.modelRegistry.putObject(new ModelResourceLocation("techreborn:cable#type=" + type.getName().toLowerCase()), new RenderCablePart(type));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void textureStichEvent(TextureStitchEvent event){
|
||||
for(EnumCableType type : EnumCableType.values()){
|
||||
event.map.registerSprite(new ResourceLocation(type.textureName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ public class RenderCablePart implements ISmartMultipartModel {
|
|||
ArrayList<BakedQuad> list = new ArrayList<BakedQuad>();
|
||||
BlockFaceUV uv = new BlockFaceUV(new float[]{0.0F, 0.0F, 16.0F, 16.0F}, 0);
|
||||
BlockPartFace face = new BlockPartFace(null, 0, "", uv);
|
||||
int thickness = 16 - (int) type.cableThickness * 2;
|
||||
int lastThickness = 16 - thickness;
|
||||
double thickness = type.cableThickness;
|
||||
double lastThickness = 16 - thickness;
|
||||
addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture);
|
||||
if (state != null) {
|
||||
if (state.getValue(CableMultipart.UP)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue