Fixed server crash
This commit is contained in:
parent
91a0d76f46
commit
b0c77d4d22
4 changed files with 74 additions and 67 deletions
|
@ -6,8 +6,6 @@ import erogenousbeef.coreTR.multiblock.BlockMultiblockBase;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -82,42 +80,26 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
// up down left right
|
// up down left right
|
||||||
icons[i][0] = genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i);
|
icons[i][0] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i, types);
|
||||||
icons[i][1] = genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i);
|
icons[i][1] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i, types);
|
||||||
icons[i][2] = genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i);
|
icons[i][2] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i, types);
|
||||||
icons[i][3] = genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i);
|
icons[i][3] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i, types);
|
||||||
icons[i][4] = genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i);
|
icons[i][4] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i, types);
|
||||||
icons[i][5] = genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i);
|
icons[i][5] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i, types);
|
||||||
icons[i][6] = genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i);
|
icons[i][6] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i, types);
|
||||||
icons[i][7] = genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i);
|
icons[i][7] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i, types);
|
||||||
icons[i][8] = genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i);
|
icons[i][8] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i, types);
|
||||||
icons[i][9] = genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i);
|
icons[i][9] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i, types);
|
||||||
icons[i][10] = genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i);
|
icons[i][10] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i, types);
|
||||||
icons[i][11] = genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i);
|
icons[i][11] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i, types);
|
||||||
icons[i][12] = genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i);
|
icons[i][12] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i, types);
|
||||||
icons[i][13] = genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i);
|
icons[i][13] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i, types);
|
||||||
icons[i][14] = genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i);
|
icons[i][14] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i, types);
|
||||||
icons[i][15] = genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i);
|
icons[i][15] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i, types);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon genIcon(ConnectedTexture connectedTexture, IIconRegister iconRegister, int texNum, int meta) {
|
|
||||||
if (iconRegister instanceof TextureMap) {
|
|
||||||
TextureMap map = (TextureMap) iconRegister;
|
|
||||||
String name = CasingConnectedTextureGenerator.getDerivedName(types[meta] + "." + texNum);
|
|
||||||
System.out.println(name);
|
|
||||||
TextureAtlasSprite texture = map.getTextureExtry(name);
|
|
||||||
if (texture == null) {
|
|
||||||
texture = new CasingConnectedTextureGenerator(name, types[meta], connectedTexture);
|
|
||||||
map.setTextureEntry(name, texture);
|
|
||||||
}
|
|
||||||
return map.getTextureExtry(name);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||||
|
|
|
@ -5,8 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -41,22 +39,22 @@ public class BlockLesuStorage extends BlockMachineBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
icons[i][0] = genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i);
|
icons[i][0] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i);
|
||||||
icons[i][1] = genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i);
|
icons[i][1] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i);
|
||||||
icons[i][2] = genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i);
|
icons[i][2] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i);
|
||||||
icons[i][3] = genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i);
|
icons[i][3] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i);
|
||||||
icons[i][4] = genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i);
|
icons[i][4] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i);
|
||||||
icons[i][5] = genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i);
|
icons[i][5] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i);
|
||||||
icons[i][6] = genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i);
|
icons[i][6] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i);
|
||||||
icons[i][7] = genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i);
|
icons[i][7] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i);
|
||||||
icons[i][8] = genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i);
|
icons[i][8] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i);
|
||||||
icons[i][9] = genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i);
|
icons[i][9] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i);
|
||||||
icons[i][10] = genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i);
|
icons[i][10] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i);
|
||||||
icons[i][11] = genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i);
|
icons[i][11] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i);
|
||||||
icons[i][12] = genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i);
|
icons[i][12] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i);
|
||||||
icons[i][13] = genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i);
|
icons[i][13] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i);
|
||||||
icons[i][14] = genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i);
|
icons[i][14] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i);
|
||||||
icons[i][15] = genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i);
|
icons[i][15] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,21 +69,7 @@ public class BlockLesuStorage extends BlockMachineBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IIcon genIcon(ConnectedTexture connectedTexture, IIconRegister iconRegister, int texNum, int meta) {
|
|
||||||
if (iconRegister instanceof TextureMap) {
|
|
||||||
TextureMap map = (TextureMap) iconRegister;
|
|
||||||
String name = LesuConnectedTextureGenerator.getDerivedName("lesu." + texNum);
|
|
||||||
System.out.println(name);
|
|
||||||
TextureAtlasSprite texture = map.getTextureExtry(name);
|
|
||||||
if (texture == null) {
|
|
||||||
texture = new LesuConnectedTextureGenerator(name, "lesu", connectedTexture);
|
|
||||||
map.setTextureEntry(name, texture);
|
|
||||||
}
|
|
||||||
return map.getTextureExtry(name);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
package techreborn.client.texture;
|
package techreborn.client.texture;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.client.resources.IResource;
|
import net.minecraft.client.resources.IResource;
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
|
@ -116,4 +121,21 @@ public class CasingConnectedTextureGenerator extends TextureAtlasSprite {
|
||||||
this.loadSprite(type_image, animation, (float) Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0F);
|
this.loadSprite(type_image, animation, (float) Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0F);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public static IIcon genIcon(ConnectedTexture connectedTexture, IIconRegister iconRegister, int texNum, int meta, String[] types) {
|
||||||
|
if (iconRegister instanceof TextureMap) {
|
||||||
|
TextureMap map = (TextureMap) iconRegister;
|
||||||
|
String name = CasingConnectedTextureGenerator.getDerivedName(types[meta] + "." + texNum);
|
||||||
|
System.out.println(name);
|
||||||
|
TextureAtlasSprite texture = map.getTextureExtry(name);
|
||||||
|
if (texture == null) {
|
||||||
|
texture = new CasingConnectedTextureGenerator(name, types[meta], connectedTexture);
|
||||||
|
map.setTextureEntry(name, texture);
|
||||||
|
}
|
||||||
|
return map.getTextureExtry(name);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package techreborn.client.texture;
|
package techreborn.client.texture;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.client.resources.IResource;
|
import net.minecraft.client.resources.IResource;
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
|
@ -121,4 +124,20 @@ public class LesuConnectedTextureGenerator extends TextureAtlasSprite {
|
||||||
this.loadSprite(type_image, animation, (float) Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0F);
|
this.loadSprite(type_image, animation, (float) Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0F);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IIcon genIcon(ConnectedTexture connectedTexture, IIconRegister iconRegister, int texNum, int meta) {
|
||||||
|
if (iconRegister instanceof TextureMap) {
|
||||||
|
TextureMap map = (TextureMap) iconRegister;
|
||||||
|
String name = LesuConnectedTextureGenerator.getDerivedName("lesu." + texNum);
|
||||||
|
System.out.println(name);
|
||||||
|
TextureAtlasSprite texture = map.getTextureExtry(name);
|
||||||
|
if (texture == null) {
|
||||||
|
texture = new LesuConnectedTextureGenerator(name, "lesu", connectedTexture);
|
||||||
|
map.setTextureEntry(name, texture);
|
||||||
|
}
|
||||||
|
return map.getTextureExtry(name);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue