Fixed tank glass not rendering

This commit is contained in:
Calclavia 2014-03-23 20:19:24 +08:00
parent 90a85e7dcb
commit 3791924480
3 changed files with 50 additions and 46 deletions

View file

@ -1,9 +1,26 @@
package resonantinduction.archaic; package resonantinduction.archaic;
import calclavia.lib.content.ContentRegistry;
import calclavia.lib.network.PacketAnnotation;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.prefab.item.ItemBlockMetadata;
import calclavia.lib.recipe.UniversalRecipe;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import resonantinduction.archaic.blocks.TileTurntable;
import resonantinduction.archaic.crate.BlockCrate; import resonantinduction.archaic.crate.BlockCrate;
import resonantinduction.archaic.crate.ItemBlockCrate; import resonantinduction.archaic.crate.ItemBlockCrate;
import resonantinduction.archaic.crate.TileCrate; import resonantinduction.archaic.crate.TileCrate;
@ -29,47 +46,28 @@ import resonantinduction.core.Settings;
import resonantinduction.core.TabRI; import resonantinduction.core.TabRI;
import resonantinduction.core.prefab.imprint.ItemImprint; import resonantinduction.core.prefab.imprint.ItemImprint;
import resonantinduction.core.resource.ItemHandCrank; import resonantinduction.core.resource.ItemHandCrank;
import calclavia.lib.content.ContentRegistry;
import calclavia.lib.network.PacketAnnotation;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.prefab.item.ItemBlockMetadata;
import calclavia.lib.recipe.UniversalRecipe;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
/** /**
* Resonant Induction Archaic Module * Resonant Induction Archaic Module
* *
* @author DarkCow, Calclavia * @author DarkCow, Calclavia
*/ */
@Mod(modid = Archaic.ID, name = Archaic.NAME, version = Reference.VERSION, dependencies = "required-after:" + ResonantInduction.ID) @Mod(modid = Archaic.ID, name = Archaic.NAME, version = Reference.VERSION, dependencies = "required-after:" + ResonantInduction.ID)
@NetworkMod(channels = Reference.CHANNEL, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class) @NetworkMod(channels = Reference.CHANNEL, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class Archaic public class Archaic
{ {
/** Mod Information */ /**
* Mod Information
*/
public static final String ID = "ResonantInduction|Archaic"; public static final String ID = "ResonantInduction|Archaic";
public static final String NAME = Reference.NAME + " Archaic"; public static final String NAME = Reference.NAME + " Archaic";
public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, Settings.idManager, ID).setPrefix(Reference.PREFIX).setTab(TabRI.DEFAULT);
@Instance(ID) @Instance(ID)
public static Archaic INSTANCE; public static Archaic INSTANCE;
@SidedProxy(clientSide = "resonantinduction.archaic.ClientProxy", serverSide = "resonantinduction.archaic.CommonProxy") @SidedProxy(clientSide = "resonantinduction.archaic.ClientProxy", serverSide = "resonantinduction.archaic.CommonProxy")
public static CommonProxy proxy; public static CommonProxy proxy;
@Mod.Metadata(ID) @Mod.Metadata(ID)
public static ModMetadata metadata; public static ModMetadata metadata;
public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, Settings.idManager, ID).setPrefix(Reference.PREFIX).setTab(TabRI.DEFAULT);
public static Block blockEngineeringTable; public static Block blockEngineeringTable;
public static Block blockCrate; public static Block blockCrate;
public static Block blockImprinter; public static Block blockImprinter;
@ -98,7 +96,7 @@ public class Archaic
blockEngineeringTable = contentRegistry.newBlock(TileEngineeringTable.class); blockEngineeringTable = contentRegistry.newBlock(TileEngineeringTable.class);
blockCrate = contentRegistry.createBlock(BlockCrate.class, ItemBlockCrate.class, TileCrate.class); blockCrate = contentRegistry.createBlock(BlockCrate.class, ItemBlockCrate.class, TileCrate.class);
blockImprinter = contentRegistry.createTile(BlockImprinter.class, TileImprinter.class); blockImprinter = contentRegistry.createTile(BlockImprinter.class, TileImprinter.class);
blockTurntable = contentRegistry.createBlock(TileTurntable.class); blockTurntable = contentRegistry.newBlock(TileTurntable.class);
blockFirebox = contentRegistry.createBlock(BlockFirebox.class, ItemBlockMetadata.class, TileFirebox.class); blockFirebox = contentRegistry.createBlock(BlockFirebox.class, ItemBlockMetadata.class, TileFirebox.class);
blockHotPlate = contentRegistry.createTile(BlockHotPlate.class, TileHotPlate.class); blockHotPlate = contentRegistry.createTile(BlockHotPlate.class, TileHotPlate.class);
blockMillstone = contentRegistry.createTile(BlockMillstone.class, TileMillstone.class); blockMillstone = contentRegistry.createTile(BlockMillstone.class, TileMillstone.class);

View file

@ -1,6 +1,5 @@
package resonantinduction.archaic.blocks package resonantinduction.archaic.blocks
import java.util.Random
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.IconRegister import net.minecraft.client.renderer.texture.IconRegister
@ -11,20 +10,24 @@ import net.minecraft.world.World
import net.minecraftforge.common.ForgeDirection import net.minecraftforge.common.ForgeDirection
import resonantinduction.core.Reference import resonantinduction.core.Reference
import universalelectricity.api.vector.Vector3 import universalelectricity.api.vector.Vector3
import calclavia.lib.prefab.block.BlockRotatable
import calclavia.lib.prefab.block.IRotatableBlock import calclavia.lib.prefab.block.IRotatableBlock
import calclavia.lib.prefab.tile.IRotatable import calclavia.lib.prefab.tile.IRotatable
import codechicken.multipart.TileMultipart import codechicken.multipart.TileMultipart
import cpw.mods.fml.relauncher.Side import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly import cpw.mods.fml.relauncher.SideOnly
import calclavia.lib.content.prefab.TraitRotatable import calclavia.lib.content.module.{TileRender, TileBlock}
import calclavia.lib.content.module.TileBlock import calclavia.lib.render.RotatedTextureRenderer
class TileTurntable extends TileBlock(Material.piston) with TraitRotatable object TileTurntable
{ {
textureName= "turntable_side" var top: Icon = null
}
class TileTurntable extends TileBlock(Material.piston) with IRotatable
{
textureName = "turntable_side"
tickRandomly = true tickRandomly = true
rotationMask = Byte.parseByte("111111", 2) rotationMask = Integer.parseInt("111111", 2).toByte
override def tickRate(par1World: World): Int = override def tickRate(par1World: World): Int =
{ {
@ -34,36 +37,36 @@ class TileTurntable extends TileBlock(Material.piston) with TraitRotatable
@SideOnly(Side.CLIENT) override def registerIcons(iconReg: IconRegister) @SideOnly(Side.CLIENT) override def registerIcons(iconReg: IconRegister)
{ {
super.registerIcons(iconReg) super.registerIcons(iconReg)
this.top = iconReg.registerIcon(Reference.PREFIX + "turntable") TileTurntable.top = iconReg.registerIcon(Reference.PREFIX + "turntable")
} }
override def updateTick(world: World, x: Int, y: Int, z: Int, par5Random: Random) override def updateEntity()
{ {
this.updateTurntableState(world, x, y, z) updateTurntableState(world, x, y, z)
} }
@SideOnly(Side.CLIENT) override def getBlockTexture(par1IBlockAccess: IBlockAccess, par2: Int, par3: Int, par4: Int, side: Int): Icon = @SideOnly(Side.CLIENT) override def getIcon(access: IBlockAccess, side: Int): Icon =
{ {
val meta: Int = par1IBlockAccess.getBlockMetadata(par2, par3, par4) if (side == metadata())
if (side == meta)
{ {
return this.top return TileTurntable.top
} }
return this.blockIcon
return return getIcon;
} }
@SideOnly(Side.CLIENT) override def getIcon(side: Int, meta: Int): Icon = @SideOnly(Side.CLIENT) override def getIcon(side: Int, meta: Int): Icon =
{ {
if (side == 1) if (side == 1)
{ {
return this.top return TileTurntable.top
} }
return this.blockIcon return super.getIcon
} }
override def onNeighborBlockChange(world: World, x: Int, y: Int, z: Int, side: Int) override def onNeighborChanged()
{ {
world.scheduleBlockUpdate(x, y, z, this.blockID, 10) scheduelTick(10)
} }
private def updateTurntableState(world: World, x: Int, y: Int, z: Int) private def updateTurntableState(world: World, x: Int, y: Int, z: Int)
@ -107,5 +110,8 @@ class TileTurntable extends TileBlock(Material.piston) with TraitRotatable
} }
} }
private var top: Icon = null @SideOnly(Side.CLIENT) protected override def newRenderer: TileRender =
{
return new RotatedTextureRenderer(this)
}
} }

View file

@ -46,7 +46,7 @@ public class TileTank extends TileFluidDistribution implements IComparatorInputO
@Override @Override
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side) public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side)
{ {
return access.getBlockId(x, y, z) == blockID() ? false : super.shouldSideBeRendered(access, x, y, z, side); return access.getBlockId(x, y, z) != block.blockID;
} }
@Override @Override