Fix pipe types

This commit is contained in:
modmuss50 2016-06-01 12:30:20 +01:00
parent b59794f423
commit fff952cb1a
2 changed files with 13 additions and 20 deletions

View file

@ -1,7 +1,6 @@
package techreborn.client.render.parts;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
@ -12,16 +11,12 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import techreborn.parts.fluidPipes.EnumFluidPipeTypes;
import techreborn.parts.powerCables.EnumCableType;
import java.util.HashMap;
/**
* Created by modmuss50 on 04/03/2016.
*/
public class ClientPartModelBakery
{
public static HashMap<EnumCableType, TextureAtlasSprite> textureMap = new HashMap<>();
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onModelBake(ModelBakeEvent event)
@ -29,8 +24,8 @@ public class ClientPartModelBakery
for (EnumCableType type : EnumCableType.values())
{
event.getModelRegistry().putObject(
new ModelResourceLocation("techreborn:cable#type=" + type.getName().toLowerCase()),
new RenderCablePart());
new ModelResourceLocation("techreborn:cable", "type=" + type.getName().toLowerCase()),
new RenderCablePart(type));
}
for(EnumFluidPipeTypes type : EnumFluidPipeTypes.values()){
event.getModelRegistry().putObject(
@ -46,7 +41,6 @@ public class ClientPartModelBakery
for (EnumCableType type : EnumCableType.values())
{
event.getMap().registerSprite(new ResourceLocation(type.textureName));
}
for(EnumFluidPipeTypes type : EnumFluidPipeTypes.values()){
event.getMap().registerSprite(new ResourceLocation(type.textureName));

View file

@ -19,19 +19,21 @@ import java.util.List;
public class RenderCablePart implements IBakedModel
{
EnumCableType type;
private FaceBakery faceBakery = new FaceBakery();
private TextureAtlasSprite texture;
public RenderCablePart(EnumCableType type)
{
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
this.type = type;
}
@Override
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand)
{
TextureAtlasSprite texture;
EnumCableType type = blockState.getValue(CableMultipart.TYPE);
if(ClientPartModelBakery.textureMap.containsKey(type)){
texture = ClientPartModelBakery.textureMap.get(type);
} else {
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
ClientPartModelBakery.textureMap.put(type, texture);
}
type = blockState.getValue(CableMultipart.TYPE);
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
ArrayList<BakedQuad> list = new ArrayList<>();
BlockFaceUV uv = new BlockFaceUV(new float[] { 0.0F, 0.0F, 16.0F, 16.0F }, 0);
BlockPartFace face = new BlockPartFace(null, 0, "", uv);
@ -101,10 +103,7 @@ public class RenderCablePart implements IBakedModel
@Override
public TextureAtlasSprite getParticleTexture()
{
if(ClientPartModelBakery.textureMap.containsKey(EnumCableType.COPPER)){
return ClientPartModelBakery.textureMap.get(EnumCableType.COPPER);
}
return Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
return texture;
}
@Override