Uses Reborncores version of MCMP

This commit is contained in:
modmuss50 2016-06-01 12:06:51 +01:00
parent 73d771dd72
commit 96235d2c9d
11 changed files with 41 additions and 34 deletions

View file

@ -1,6 +1,7 @@
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;
@ -11,12 +12,16 @@ 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)
@ -25,7 +30,7 @@ public class ClientPartModelBakery
{
event.getModelRegistry().putObject(
new ModelResourceLocation("techreborn:cable#type=" + type.getName().toLowerCase()),
new RenderCablePart(type));
new RenderCablePart());
}
for(EnumFluidPipeTypes type : EnumFluidPipeTypes.values()){
event.getModelRegistry().putObject(
@ -41,6 +46,7 @@ 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,19 @@ 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);
}
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,7 +101,10 @@ public class RenderCablePart implements IBakedModel
@Override
public TextureAtlasSprite getParticleTexture()
{
return texture;
if(ClientPartModelBakery.textureMap.containsKey(EnumCableType.COPPER)){
return ClientPartModelBakery.textureMap.get(EnumCableType.COPPER);
}
return Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
@Override