mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-23 16:44:50 +00:00
Lower case all resource names
- Lower case all model and texture names - Move model registration code into preInit - this ensures we don't get texture/model errors in the preInit stage.
This commit is contained in:
@@ -20,8 +20,8 @@ import java.util.Arrays;
|
||||
|
||||
public class FixedWidthFontRenderer
|
||||
{
|
||||
public static ResourceLocation font = new ResourceLocation( "computercraft", "textures/gui/termFont.png" );
|
||||
public static ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/termBackground.png" );
|
||||
public static ResourceLocation font = new ResourceLocation( "computercraft", "textures/gui/term_font.png" );
|
||||
public static ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/term_background.png" );
|
||||
|
||||
public static int FONT_HEIGHT = 9;
|
||||
public static int FONT_WIDTH = 6;
|
||||
|
||||
@@ -25,8 +25,8 @@ import java.io.IOException;
|
||||
public class GuiComputer extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/corners.png" );
|
||||
private static final ResourceLocation backgroundAdvanced = new ResourceLocation( "computercraft", "textures/gui/corners2.png" );
|
||||
private static final ResourceLocation backgroundCommand = new ResourceLocation( "computercraft", "textures/gui/cornersCommand.png" );
|
||||
private static final ResourceLocation backgroundAdvanced = new ResourceLocation( "computercraft", "textures/gui/corners_advanced.png" );
|
||||
private static final ResourceLocation backgroundCommand = new ResourceLocation( "computercraft", "textures/gui/corners_command.png" );
|
||||
|
||||
private final ComputerFamily m_family;
|
||||
private final IComputer m_computer;
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.IOException;
|
||||
public class GuiTurtle extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/turtle.png" );
|
||||
private static final ResourceLocation backgroundAdvanced = new ResourceLocation( "computercraft", "textures/gui/turtle2.png" );
|
||||
private static final ResourceLocation backgroundAdvanced = new ResourceLocation( "computercraft", "textures/gui/turtle_advanced.png" );
|
||||
|
||||
protected World m_world;
|
||||
protected ContainerTurtle m_container;
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.ArrayList;
|
||||
|
||||
public class WidgetTerminal extends Widget
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/termBackground.png" );
|
||||
private static final ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/term_background.png" );
|
||||
private static float TERMINATE_TIME = 0.5f;
|
||||
|
||||
private final IComputerContainer m_computer;
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
@@ -42,16 +43,12 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
||||
{
|
||||
public CCTurtleProxyClient()
|
||||
{
|
||||
}
|
||||
|
||||
// IComputerCraftProxy implementation
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
public void preInit()
|
||||
{
|
||||
super.init();
|
||||
super.preInit();
|
||||
|
||||
// Register item models
|
||||
ItemMeshDefinition turtleMeshDefinition = new ItemMeshDefinition()
|
||||
@@ -67,7 +64,7 @@ public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
||||
};
|
||||
String[] turtleModelNames = new String[] {
|
||||
"turtle_dynamic",
|
||||
"CC-Turtle", "CC-TurtleAdvanced",
|
||||
"turtle", "turtle_advanced",
|
||||
"turtle_white",
|
||||
"turtle_elf_overlay"
|
||||
};
|
||||
@@ -75,6 +72,15 @@ public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
||||
registerItemModel( ComputerCraft.Blocks.turtleExpanded, turtleMeshDefinition, turtleModelNames );
|
||||
registerItemModel( ComputerCraft.Blocks.turtleAdvanced, turtleMeshDefinition, turtleModelNames );
|
||||
|
||||
// Setup client forge handlers
|
||||
registerForgeHandlers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
// Setup turtle colours
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(
|
||||
new TurtleItemColour(),
|
||||
@@ -83,9 +89,6 @@ public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
||||
|
||||
// Setup renderers
|
||||
ClientRegistry.bindTileEntitySpecialRenderer( TileTurtle.class, new TileEntityTurtleRenderer() );
|
||||
|
||||
// Setup client forge handlers
|
||||
registerForgeHandlers();
|
||||
}
|
||||
|
||||
private void registerItemModel( Block block, ItemMeshDefinition definition, String[] names )
|
||||
@@ -101,7 +104,7 @@ public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
||||
resources[i] = new ResourceLocation( "computercraft:" + names[i] );
|
||||
}
|
||||
ModelBakery.registerItemVariants( item, resources );
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( item, definition );
|
||||
ModelLoader.setCustomMeshDefinition( item, definition );
|
||||
}
|
||||
|
||||
private void registerForgeHandlers()
|
||||
@@ -137,7 +140,7 @@ public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
||||
@SubscribeEvent
|
||||
public void onTextureStitchEvent( TextureStitchEvent.Pre event )
|
||||
{
|
||||
event.getMap().registerSprite( new ResourceLocation( "computercraft", "blocks/craftyUpgrade" ) );
|
||||
event.getMap().registerSprite( new ResourceLocation( "computercraft", "blocks/crafty_upgrade" ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -46,6 +46,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
@@ -65,27 +67,19 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
|
||||
private long m_renderFrame;
|
||||
private FixedWidthFontRenderer m_fixedWidthFontRenderer;
|
||||
|
||||
public ComputerCraftProxyClient()
|
||||
{
|
||||
}
|
||||
|
||||
// IComputerCraftProxy implementation
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
public void preInit()
|
||||
{
|
||||
super.init();
|
||||
super.preInit();
|
||||
m_tick = 0;
|
||||
m_renderFrame = 0;
|
||||
|
||||
// Load textures
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
m_fixedWidthFontRenderer = new FixedWidthFontRenderer( mc.getTextureManager() );
|
||||
|
||||
// Register item models
|
||||
registerItemModel( ComputerCraft.Blocks.computer, new ItemMeshDefinition()
|
||||
{
|
||||
private ModelResourceLocation computer = new ModelResourceLocation( "computercraft:CC-Computer", "inventory" );
|
||||
private ModelResourceLocation computer = new ModelResourceLocation( "computercraft:computer", "inventory" );
|
||||
private ModelResourceLocation advanced_computer = new ModelResourceLocation( "computercraft:advanced_computer", "inventory" );
|
||||
|
||||
@Nonnull
|
||||
@@ -96,26 +90,26 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
|
||||
ComputerFamily family = itemComputer.getFamily( stack.getItemDamage() );
|
||||
return ( family == ComputerFamily.Advanced ) ? advanced_computer : computer;
|
||||
}
|
||||
}, new String[]{ "CC-Computer", "advanced_computer" } );
|
||||
registerItemModel( ComputerCraft.Blocks.peripheral, 0, "CC-Peripheral" );
|
||||
}, new String[]{ "computer", "advanced_computer" } );
|
||||
registerItemModel( ComputerCraft.Blocks.peripheral, 0, "peripheral" );
|
||||
registerItemModel( ComputerCraft.Blocks.peripheral, 1, "wireless_modem" );
|
||||
registerItemModel( ComputerCraft.Blocks.peripheral, 2, "monitor" );
|
||||
registerItemModel( ComputerCraft.Blocks.peripheral, 3, "printer" );
|
||||
registerItemModel( ComputerCraft.Blocks.peripheral, 4, "advanced_monitor" );
|
||||
registerItemModel( ComputerCraft.Blocks.cable, 0, "CC-Cable" );
|
||||
registerItemModel( ComputerCraft.Blocks.cable, 0, "cable" );
|
||||
registerItemModel( ComputerCraft.Blocks.cable, 1, "wired_modem" );
|
||||
registerItemModel( ComputerCraft.Blocks.commandComputer, "command_computer" );
|
||||
registerItemModel( ComputerCraft.Blocks.advancedModem, "advanced_modem" );
|
||||
|
||||
registerItemModel( ComputerCraft.Items.disk, "disk" );
|
||||
registerItemModel( ComputerCraft.Items.diskExpanded, "diskExpanded" );
|
||||
registerItemModel( ComputerCraft.Items.treasureDisk, "treasureDisk" );
|
||||
registerItemModel( ComputerCraft.Items.diskExpanded, "disk_expanded" );
|
||||
registerItemModel( ComputerCraft.Items.treasureDisk, "treasure_disk" );
|
||||
registerItemModel( ComputerCraft.Items.printout, 0, "printout" );
|
||||
registerItemModel( ComputerCraft.Items.printout, 1, "pages" );
|
||||
registerItemModel( ComputerCraft.Items.printout, 2, "book" );
|
||||
registerItemModel( ComputerCraft.Items.pocketComputer, new ItemMeshDefinition()
|
||||
{
|
||||
private ModelResourceLocation pocket_computer_off = new ModelResourceLocation( "computercraft:pocketComputer", "inventory" );
|
||||
private ModelResourceLocation pocket_computer_off = new ModelResourceLocation( "computercraft:pocket_computer", "inventory" );
|
||||
private ModelResourceLocation pocket_computer_on = new ModelResourceLocation( "computercraft:pocket_computer_on", "inventory" );
|
||||
private ModelResourceLocation pocket_computer_blinking = new ModelResourceLocation( "computercraft:pocket_computer_blinking", "inventory" );
|
||||
private ModelResourceLocation advanced_pocket_computer_off = new ModelResourceLocation( "computercraft:advanced_pocket_computer_off", "inventory" );
|
||||
@@ -171,10 +165,23 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
|
||||
}
|
||||
}
|
||||
}, new String[] {
|
||||
"pocketComputer", "pocket_computer_on", "pocket_computer_blinking",
|
||||
"pocket_computer", "pocket_computer_on", "pocket_computer_blinking",
|
||||
"advanced_pocket_computer_off", "advanced_pocket_computer_on", "advanced_pocket_computer_blinking",
|
||||
} );
|
||||
|
||||
// Setup client forge handlers
|
||||
registerForgeHandlers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
// Load textures
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
m_fixedWidthFontRenderer = new FixedWidthFontRenderer( mc.getTextureManager() );
|
||||
|
||||
// Setup
|
||||
mc.getItemColors().registerItemColorHandler( new DiskColorHandler( ComputerCraft.Items.disk ), ComputerCraft.Items.disk );
|
||||
mc.getItemColors().registerItemColorHandler( new DiskColorHandler( ComputerCraft.Items.diskExpanded ), ComputerCraft.Items.diskExpanded );
|
||||
@@ -193,9 +200,6 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
|
||||
|
||||
// Setup renderers
|
||||
ClientRegistry.bindTileEntitySpecialRenderer( TileMonitor.class, new TileEntityMonitorRenderer() );
|
||||
|
||||
// Setup client forge handlers
|
||||
registerForgeHandlers();
|
||||
}
|
||||
|
||||
private void registerItemModel( Block block, int damage, String name )
|
||||
@@ -207,7 +211,7 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
|
||||
{
|
||||
ModelResourceLocation res = new ModelResourceLocation( "computercraft:" + name, "inventory" );
|
||||
ModelBakery.registerItemVariants( item, new ResourceLocation( "computercraft", name ) );
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( item, damage, res );
|
||||
ModelLoader.setCustomModelResourceLocation( item, damage, res );
|
||||
}
|
||||
|
||||
private void registerItemModel( Block block, String name )
|
||||
@@ -219,7 +223,7 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
|
||||
{
|
||||
final ModelResourceLocation res = new ModelResourceLocation( "computercraft:" + name, "inventory" );
|
||||
ModelBakery.registerItemVariants( item, new ResourceLocation( "computercraft", name ) );
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( item, new ItemMeshDefinition()
|
||||
ModelLoader.setCustomMeshDefinition( item, new ItemMeshDefinition()
|
||||
{
|
||||
@Nonnull
|
||||
@Override
|
||||
@@ -243,7 +247,7 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
|
||||
resources[i] = new ResourceLocation( "computercraft", names[i] );
|
||||
}
|
||||
ModelBakery.registerItemVariants( item, resources );
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( item, definition );
|
||||
ModelLoader.setCustomMeshDefinition( item, definition );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,8 +47,8 @@ import java.util.List;
|
||||
|
||||
public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurtle>
|
||||
{
|
||||
private static ModelResourceLocation NORMAL_TURTLE_MODEL = new ModelResourceLocation( "computercraft:CC-Turtle", "inventory" );
|
||||
private static ModelResourceLocation ADVANCED_TURTLE_MODEL = new ModelResourceLocation( "computercraft:CC-TurtleAdvanced", "inventory" );
|
||||
private static ModelResourceLocation NORMAL_TURTLE_MODEL = new ModelResourceLocation( "computercraft:turtle", "inventory" );
|
||||
private static ModelResourceLocation ADVANCED_TURTLE_MODEL = new ModelResourceLocation( "computercraft:turtle_advanced", "inventory" );
|
||||
private static ModelResourceLocation COLOUR_TURTLE_MODEL = new ModelResourceLocation( "computercraft:turtle_white", "inventory" );
|
||||
private static ModelResourceLocation BEGINNER_TURTLE_MODEL = new ModelResourceLocation( "computercraftedu:CC-TurtleJunior", "inventory" );
|
||||
private static ModelResourceLocation[] BEGINNER_TURTLE_COLOUR_MODELS = new ModelResourceLocation[] {
|
||||
|
||||
Reference in New Issue
Block a user