removed TE renderer for mirrors, new turret models
7310
src/main/java/assets/hbm/models/turrets/turret_chekhov.obj
Normal file
1950
src/main/java/assets/hbm/models/turrets/turret_jeremy.obj
Normal file
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 913 B |
BIN
src/main/java/assets/hbm/textures/models/turrets/base.png
Normal file
|
After Width: | Height: | Size: 653 B |
BIN
src/main/java/assets/hbm/textures/models/turrets/base/base.png
Normal file
|
After Width: | Height: | Size: 418 B |
|
After Width: | Height: | Size: 515 B |
|
After Width: | Height: | Size: 997 B |
|
After Width: | Height: | Size: 303 B |
|
After Width: | Height: | Size: 216 B |
BIN
src/main/java/assets/hbm/textures/models/turrets/base/jeremy.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/main/java/assets/hbm/textures/models/turrets/carriage.png
Normal file
|
After Width: | Height: | Size: 703 B |
BIN
src/main/java/assets/hbm/textures/models/turrets/chekhov.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 387 B |
BIN
src/main/java/assets/hbm/textures/models/turrets/connector.png
Normal file
|
After Width: | Height: | Size: 216 B |
BIN
src/main/java/assets/hbm/textures/models/turrets/jeremy.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
@ -793,6 +793,8 @@ public class ModBlocks {
|
||||
public static Block turret_cwis;
|
||||
public static Block turret_cheapo;
|
||||
|
||||
public static Block turret_chekhov;
|
||||
|
||||
public static Block book_guide;
|
||||
|
||||
public static Block rail_highspeed;
|
||||
@ -1465,6 +1467,8 @@ public class ModBlocks {
|
||||
turret_cwis = new TurretCIWS(Material.iron).setBlockName("turret_cwis").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":turret_cwis");
|
||||
turret_cheapo = new TurretCheapo(Material.iron).setBlockName("turret_cheapo").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":turret_cheapo");
|
||||
|
||||
turret_chekhov = new TurretChekhov(Material.iron).setBlockName("turret_chekhov").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":turret_chekhov");
|
||||
|
||||
book_guide = new Guide(Material.iron).setBlockName("book_guide").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.nukeTab);
|
||||
|
||||
rail_highspeed = new RailHighspeed().setBlockName("rail_highspeed").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_highspeed");
|
||||
@ -1958,6 +1962,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(turret_spitfire, turret_spitfire.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(turret_cwis, ItemBlockLore.class, turret_cwis.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(turret_cheapo, turret_cheapo.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(turret_chekhov, turret_chekhov.getUnlocalizedName());
|
||||
|
||||
//Mines
|
||||
GameRegistry.registerBlock(mine_ap, mine_ap.getUnlocalizedName());
|
||||
|
||||
34
src/main/java/com/hbm/blocks/bomb/TurretChekhov.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.bomb.TileEntityTurretChekhov;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TurretChekhov extends BlockDummyable {
|
||||
|
||||
public TurretChekhov(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityTurretChekhov();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 1, 0, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntitySolarMirror;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -17,17 +18,19 @@ public class SolarMirror extends BlockContainer {
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntitySolarMirror();
|
||||
}
|
||||
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return -1;
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
|
||||
@ -13,68 +13,57 @@ import net.minecraft.item.ItemStack;
|
||||
public class ContainerMachineGasFlare extends Container {
|
||||
|
||||
private TileEntityMachineGasFlare testNuke;
|
||||
|
||||
|
||||
public ContainerMachineGasFlare(InventoryPlayer invPlayer, TileEntityMachineGasFlare tedf) {
|
||||
|
||||
|
||||
testNuke = tedf;
|
||||
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 44, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 134, 17));
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 134, 53));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 1) {
|
||||
if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true))
|
||||
{
|
||||
|
||||
if(par2 <= 1) {
|
||||
if(!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if(!this.mergeItemStack(var5, 0, 2, false)) {
|
||||
return null;
|
||||
}
|
||||
else if (!this.mergeItemStack(var5, 0, 3, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
|
||||
@ -125,6 +125,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurretSpitfire.class, new RenderSpitfireTurret());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurretCIWS.class, new RenderCIWSTurret());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurretCheapo.class, new RenderCheapoTurret());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurretChekhov.class, new RenderTurretChekhov());
|
||||
//mines
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLandmine.class, new RenderLandmine());
|
||||
//cel prime
|
||||
@ -169,7 +170,6 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineLargeTurbine.class, new RenderBigTurbine());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineReactor.class, new RenderBreeder());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySolarBoiler.class, new RenderSolarBoiler());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySolarMirror.class, new RenderSolarMirror());
|
||||
//AMS
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSBase.class, new RenderAMSBase());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAMSEmitter.class, new RenderAMSEmitter());
|
||||
@ -526,6 +526,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerBlockHandler(new RenderRTGBlock());
|
||||
RenderingRegistry.registerBlockHandler(new RenderSpikeBlock());
|
||||
RenderingRegistry.registerBlockHandler(new RenderChain());
|
||||
RenderingRegistry.registerBlockHandler(new RenderMirror());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -449,6 +449,7 @@ public class MainRegistry {
|
||||
GameRegistry.registerTileEntity(TileEntityMachineDetector.class, "tileentity_he_detector");
|
||||
GameRegistry.registerTileEntity(TileEntityFireworks.class, "tileentity_firework_box");
|
||||
GameRegistry.registerTileEntity(TileEntityCrateTungsten.class, "tileentity_crate_hot");
|
||||
GameRegistry.registerTileEntity(TileEntityTurretChekhov.class, "tileentity_turret_chekhov");
|
||||
|
||||
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
|
||||
|
||||
@ -37,6 +37,9 @@ public class ResourceManager {
|
||||
public static final IModelCustom turret_cwis_gun = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/cwis_gun.obj"));
|
||||
public static final IModelCustom turret_cheapo_head = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/turret_cheapo_head.obj"));
|
||||
public static final IModelCustom turret_cheapo_gun = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/turret_cheapo_gun.obj"));
|
||||
|
||||
public static final IModelCustom turret_chekhov = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_chekhov.obj"));
|
||||
public static final IModelCustom turret_jeremy = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_jeremy.obj"));
|
||||
|
||||
//Landmines
|
||||
public static final IModelCustom mine_ap = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mine_ap.obj"));
|
||||
@ -211,7 +214,7 @@ public class ResourceManager {
|
||||
|
||||
//Solar Tower
|
||||
public static final IModelCustom solar_boiler = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/solar_boiler.obj"));
|
||||
public static final IModelCustom solar_mirror = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/solar_mirror.obj"));
|
||||
public static final IModelCustom solar_mirror = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/solar_mirror.obj"));
|
||||
|
||||
//Vault Door
|
||||
public static final IModelCustom vault_cog = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vault_cog.obj"));
|
||||
@ -259,6 +262,13 @@ public class ResourceManager {
|
||||
public static final ResourceLocation turret_cheapo_head_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turret_cheapo_head.png");
|
||||
public static final ResourceLocation turret_cheapo_gun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turret_cheapo_gun.png");
|
||||
|
||||
public static final ResourceLocation turret_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/base.png");
|
||||
public static final ResourceLocation turret_carriage_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/carriage.png");
|
||||
public static final ResourceLocation turret_connector_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/connector.png");
|
||||
public static final ResourceLocation turret_chekhov_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/chekhov.png");
|
||||
public static final ResourceLocation turret_chekhov_barrels_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/chekhov_barrels.png");
|
||||
public static final ResourceLocation turret_jeremy_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/jeremy.png");
|
||||
|
||||
//Landmines
|
||||
public static final ResourceLocation mine_ap_tex = new ResourceLocation(RefStrings.MODID, "textures/models/mine_ap.png");
|
||||
public static final ResourceLocation mine_he_tex = new ResourceLocation(RefStrings.MODID, "textures/models/mine_he.png");
|
||||
|
||||
124
src/main/java/com/hbm/render/block/RenderMirror.java
Normal file
@ -0,0 +1,124 @@
|
||||
package com.hbm.render.block;
|
||||
|
||||
import com.hbm.blocks.machine.SolarMirror;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.ObjUtil;
|
||||
import com.hbm.tileentity.machine.TileEntitySolarMirror;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.model.obj.Face;
|
||||
import net.minecraftforge.client.model.obj.GroupObject;
|
||||
import net.minecraftforge.client.model.obj.TextureCoordinate;
|
||||
import net.minecraftforge.client.model.obj.Vertex;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
||||
public class RenderMirror implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { }
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IIcon iicon = block.getIcon(0, world.getBlockMetadata(x, y, z));
|
||||
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
|
||||
if(renderer.hasOverrideBlockTexture()) {
|
||||
iicon = renderer.overrideBlockTexture;
|
||||
}
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof TileEntitySolarMirror))
|
||||
return false;
|
||||
|
||||
TileEntitySolarMirror mirror = (TileEntitySolarMirror) te;
|
||||
|
||||
int dx = mirror.tX - mirror.xCoord;
|
||||
int dy = mirror.tY - mirror.yCoord;
|
||||
int dz = mirror.tZ - mirror.zCoord;
|
||||
|
||||
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.solar_mirror, "Base", iicon, tessellator, 0, true);
|
||||
|
||||
if(mirror.tY <= mirror.yCoord)
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.solar_mirror, "Mirror", iicon, tessellator, 0, true);
|
||||
else
|
||||
printMirror(iicon, dx, dy, dz);
|
||||
|
||||
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void printMirror(IIcon icon, int dx, int dy, int dz) {
|
||||
|
||||
GroupObject go = null;
|
||||
|
||||
for(GroupObject obj : ((WavefrontObject)ResourceManager.solar_mirror).groupObjects) {
|
||||
if(obj.name.equals("Mirror"))
|
||||
go = obj;
|
||||
}
|
||||
|
||||
if(go == null)
|
||||
return;
|
||||
|
||||
Tessellator tes = Tessellator.instance;
|
||||
|
||||
double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
double pitch = -Math.asin((dy + 0.5) / dist) + Math.PI / 2D;
|
||||
double yaw = -Math.atan2(dz, dx) - Math.PI / 2D;
|
||||
|
||||
for(Face f : go.faces) {
|
||||
|
||||
Vertex n = f.faceNormal;
|
||||
|
||||
tes.setNormal(n.x, n.y, n.z);
|
||||
float brightness = (n.y + 1) * 0.65F;
|
||||
|
||||
if(brightness < 0.45F)
|
||||
brightness = 0.45F;
|
||||
|
||||
tes.setColorOpaque_F(brightness, brightness, brightness);
|
||||
|
||||
for(int i = 0; i < f.vertices.length; i++) {
|
||||
|
||||
Vertex v = f.vertices[i];
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(v.x, v.y - 1, v.z);
|
||||
vec.rotateAroundX((float) pitch);
|
||||
vec.rotateAroundY((float) yaw);
|
||||
|
||||
float x = (float) vec.xCoord;
|
||||
float y = (float) vec.yCoord + 1;
|
||||
float z = (float) vec.zCoord;
|
||||
|
||||
TextureCoordinate t = f.textureCoordinates[i];
|
||||
tes.addVertexWithUV(x, y, z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
|
||||
|
||||
if(i % 3 == 2)
|
||||
tes.addVertexWithUV(x, y, z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return SolarMirror.renderID;
|
||||
}
|
||||
}
|
||||
@ -1,21 +1,27 @@
|
||||
package com.hbm.render.entity.mob;
|
||||
|
||||
import com.hbm.entity.mob.EntityDuck;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderChicken;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.passive.EntityChicken;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderDuck extends RenderChicken {
|
||||
|
||||
public static final ResourceLocation ducc = new ResourceLocation(RefStrings.MODID, "textures/entity/duck.png");
|
||||
|
||||
|
||||
public RenderDuck(ModelBase p_i1252_1_, float p_i1252_2_) {
|
||||
super(p_i1252_1_, p_i1252_2_);
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(EntityChicken p_110775_1_) {
|
||||
return ducc;
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getEntityTexture((EntityDuck) entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(EntityDuck entity) {
|
||||
return ducc;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,36 +4,118 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.machine.TileEntitySolarBoiler;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
public class RenderSolarBoiler extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
|
||||
switch(te.getBlockMetadata() - BlockDummyable.offset)
|
||||
{
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
|
||||
switch(te.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
bindTexture(ResourceManager.solar_tex);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
ResourceManager.solar_boiler.renderPart("Base");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
bindTexture(ResourceManager.solar_tex);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
ResourceManager.solar_boiler.renderPart("Base");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if(te instanceof TileEntitySolarBoiler) {
|
||||
TileEntitySolarBoiler boiler = (TileEntitySolarBoiler) te;
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
for(ChunkCoordinates co : boiler.secondary) {
|
||||
|
||||
int dx = boiler.xCoord - co.posX;
|
||||
int dy = boiler.yCoord - co.posY;
|
||||
int dz = boiler.zCoord - co.posZ;
|
||||
|
||||
double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
|
||||
float min = 0.005F;
|
||||
float max = 0.01F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(-dx, -dy, -dz);
|
||||
|
||||
double pitch = Math.toDegrees(-Math.asin((dy + 0.5) / dist)) + 90;
|
||||
double yaw = Math.toDegrees(-Math.atan2(dz, dx)) + 180;
|
||||
|
||||
GL11.glTranslated(0, 1, 0);
|
||||
GL11.glRotated(yaw, 0, 1, 0);
|
||||
GL11.glRotated(pitch, 0, 0, 1);
|
||||
GL11.glTranslated(0, -1, 0);
|
||||
|
||||
tess.startDrawingQuads();
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, max);
|
||||
tess.addVertex(0.5, 1.0625, 0.5);
|
||||
tess.addVertex(0.5, 1.0625, -0.5);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, min);
|
||||
tess.addVertex(0.5, dist, -0.5);
|
||||
tess.addVertex(0.5, dist, 0.5);
|
||||
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, max);
|
||||
tess.addVertex(-0.5, 1.0625, 0.5);
|
||||
tess.addVertex(-0.5, 1.0625, -0.5);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, min);
|
||||
tess.addVertex(-0.5, dist, -0.5);
|
||||
tess.addVertex(-0.5, dist, 0.5);
|
||||
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, max);
|
||||
tess.addVertex(0.5, 1.0625, 0.5);
|
||||
tess.addVertex(-0.5, 1.0625, 0.5);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, min);
|
||||
tess.addVertex(-0.5, dist, 0.5);
|
||||
tess.addVertex(0.5, dist, 0.5);
|
||||
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, max);
|
||||
tess.addVertex(0.5, 1.0625, -0.5);
|
||||
tess.addVertex(-0.5, 1.0625, -0.5);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, min);
|
||||
tess.addVertex(-0.5, dist, -0.5);
|
||||
tess.addVertex(0.5, dist, -0.5);
|
||||
|
||||
tess.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,104 +0,0 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.machine.TileEntitySolarMirror;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
|
||||
public class RenderSolarMirror extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
TileEntitySolarMirror mirror = (TileEntitySolarMirror)te;
|
||||
|
||||
bindTexture(ResourceManager.solar_mirror_tex);
|
||||
ResourceManager.solar_mirror.renderPart("Base");
|
||||
|
||||
GL11.glTranslated(0, 1, 0);
|
||||
|
||||
int dx = mirror.tX - mirror.xCoord;
|
||||
int dy = mirror.tY - mirror.yCoord;
|
||||
int dz = mirror.tZ - mirror.zCoord;
|
||||
|
||||
double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
|
||||
if(mirror.tY >= mirror.yCoord) {
|
||||
|
||||
double pitch = Math.toDegrees(-Math.asin((dy + 0.5) / dist)) + 90;
|
||||
double yaw = Math.toDegrees(-Math.atan2(dz, dx)) + 180;
|
||||
|
||||
GL11.glRotated(yaw, 0, 1, 0);
|
||||
GL11.glRotated(pitch, 0, 0, 1);
|
||||
}
|
||||
|
||||
GL11.glTranslated(0, -1, 0);
|
||||
ResourceManager.solar_mirror.renderPart("Mirror");
|
||||
|
||||
if(mirror.isOn) {
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
float min = 0.005F;
|
||||
float max = 0.01F;
|
||||
|
||||
tess.startDrawingQuads();
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, max);
|
||||
tess.addVertex(0.5, 1.0625, 0.5);
|
||||
tess.addVertex(0.5, 1.0625, -0.5);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, min);
|
||||
tess.addVertex(0.5, dist, -0.5);
|
||||
tess.addVertex(0.5, dist, 0.5);
|
||||
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, max);
|
||||
tess.addVertex(-0.5, 1.0625, 0.5);
|
||||
tess.addVertex(-0.5, 1.0625, -0.5);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, min);
|
||||
tess.addVertex(-0.5, dist, -0.5);
|
||||
tess.addVertex(-0.5, dist, 0.5);
|
||||
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, max);
|
||||
tess.addVertex(0.5, 1.0625, 0.5);
|
||||
tess.addVertex(-0.5, 1.0625, 0.5);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, min);
|
||||
tess.addVertex(-0.5, dist, 0.5);
|
||||
tess.addVertex(0.5, dist, 0.5);
|
||||
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, max);
|
||||
tess.addVertex(0.5, 1.0625, -0.5);
|
||||
tess.addVertex(-0.5, 1.0625, -0.5);
|
||||
tess.setColorRGBA_F(1F, 1F, 1F, min);
|
||||
tess.addVertex(-0.5, dist, -0.5);
|
||||
tess.addVertex(0.5, dist, -0.5);
|
||||
tess.draw();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class RenderTurretChekhov extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 1D, y, z + 1D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
bindTexture(ResourceManager.turret_base_tex);
|
||||
ResourceManager.turret_chekhov.renderPart("Base");
|
||||
|
||||
GL11.glRotated(System.currentTimeMillis() / 100D % 360, 0, 1, 0);
|
||||
bindTexture(ResourceManager.turret_carriage_tex);
|
||||
ResourceManager.turret_chekhov.renderPart("Carriage");
|
||||
|
||||
GL11.glTranslated(0, 1.5, 0);
|
||||
GL11.glRotated(Math.sin(System.currentTimeMillis() / 1000D) * 30, 0, 0, 1);
|
||||
GL11.glTranslated(0, -1.5, 0);
|
||||
bindTexture(ResourceManager.turret_chekhov_tex);
|
||||
ResourceManager.turret_chekhov.renderPart("Body");
|
||||
|
||||
GL11.glTranslated(0, 1.5, 0);
|
||||
GL11.glRotated(System.currentTimeMillis() % 360, -1, 0, 0);
|
||||
GL11.glTranslated(0, -1.5, 0);
|
||||
bindTexture(ResourceManager.turret_chekhov_barrels_tex);
|
||||
ResourceManager.turret_chekhov.renderPart("Barrels");
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,59 +10,58 @@ import net.minecraftforge.client.model.obj.Vertex;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
||||
public class ObjUtil {
|
||||
|
||||
public static void renderWithIcon(WavefrontObject model, IIcon icon, Tessellator tes, float rot, boolean shadow)
|
||||
{
|
||||
for(GroupObject go : model.groupObjects)
|
||||
{
|
||||
for(Face f : go.faces) {
|
||||
|
||||
Vertex n = f.faceNormal;
|
||||
tes.setNormal(n.x, n.y, n.z);
|
||||
|
||||
if(shadow) {
|
||||
float brightness = (n.y + 1) * 0.65F;
|
||||
|
||||
if(brightness < 0.45F)
|
||||
brightness = 0.45F;
|
||||
|
||||
tes.setColorOpaque_F(brightness, brightness, brightness);
|
||||
}
|
||||
|
||||
for(int i = 0; i < f.vertices.length; i++) {
|
||||
|
||||
Vertex v = f.vertices[i];
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(v.x, v.y, v.z);
|
||||
vec.rotateAroundY(rot);
|
||||
|
||||
float x = (float)vec.xCoord;
|
||||
float y = (float)vec.yCoord;
|
||||
float z = (float)vec.zCoord;
|
||||
|
||||
TextureCoordinate t = f.textureCoordinates[i];
|
||||
tes.addVertexWithUV(x, y, z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
|
||||
|
||||
//The shoddy way of rendering a tringulated model with a quad tessellator
|
||||
if(i % 3 == 2)
|
||||
tes.addVertexWithUV(x, y, z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderPartWithIcon(WavefrontObject model, String name, IIcon icon, Tessellator tes, float rot, boolean shadow) {
|
||||
|
||||
GroupObject go = null;
|
||||
|
||||
for(GroupObject obj : model.groupObjects) {
|
||||
if(obj.name.equals(name))
|
||||
go = obj;
|
||||
}
|
||||
|
||||
if(go == null)
|
||||
return;
|
||||
|
||||
public static void renderWithIcon(WavefrontObject model, IIcon icon, Tessellator tes, float rot, boolean shadow) {
|
||||
for(GroupObject go : model.groupObjects) {
|
||||
for(Face f : go.faces) {
|
||||
|
||||
Vertex n = f.faceNormal;
|
||||
tes.setNormal(n.x, n.y, n.z);
|
||||
|
||||
if(shadow) {
|
||||
float brightness = (n.y + 1) * 0.65F;
|
||||
|
||||
if(brightness < 0.45F)
|
||||
brightness = 0.45F;
|
||||
|
||||
tes.setColorOpaque_F(brightness, brightness, brightness);
|
||||
}
|
||||
|
||||
for(int i = 0; i < f.vertices.length; i++) {
|
||||
|
||||
Vertex v = f.vertices[i];
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(v.x, v.y, v.z);
|
||||
vec.rotateAroundY(rot);
|
||||
|
||||
float x = (float) vec.xCoord;
|
||||
float y = (float) vec.yCoord;
|
||||
float z = (float) vec.zCoord;
|
||||
|
||||
TextureCoordinate t = f.textureCoordinates[i];
|
||||
tes.addVertexWithUV(x, y, z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
|
||||
|
||||
// The shoddy way of rendering a tringulated model with a
|
||||
// quad tessellator
|
||||
if(i % 3 == 2)
|
||||
tes.addVertexWithUV(x, y, z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderPartWithIcon(WavefrontObject model, String name, IIcon icon, Tessellator tes, float rot, boolean shadow) {
|
||||
|
||||
GroupObject go = null;
|
||||
|
||||
for(GroupObject obj : model.groupObjects) {
|
||||
if(obj.name.equals(name))
|
||||
go = obj;
|
||||
}
|
||||
|
||||
if(go == null)
|
||||
return;
|
||||
|
||||
for(Face f : go.faces) {
|
||||
|
||||
Vertex n = f.faceNormal;
|
||||
@ -97,5 +96,5 @@ public class ObjUtil {
|
||||
tes.addVertexWithUV(x, y, z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
package com.hbm.tileentity.bomb;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityTurretChekhov extends TileEntity {
|
||||
|
||||
}
|
||||
@ -362,7 +362,9 @@ public class TileEntityMachineSatDock extends TileEntity implements ISidedInvent
|
||||
if(slots[i].stackSize <= 0)
|
||||
slots[i] = null;
|
||||
|
||||
chest.setInventorySlotContents(j, new ItemStack(sta.getItem(), 1, sta.getItemDamage()));
|
||||
ItemStack copy = chest.getStackInSlot(j).copy();
|
||||
copy.stackSize = 1;
|
||||
chest.setInventorySlotContents(j, copy);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
@ -14,6 +15,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor, IFluidSource {
|
||||
|
||||
@ -21,6 +23,9 @@ public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor,
|
||||
private FluidTank steam;
|
||||
public List<IFluidAcceptor> list = new ArrayList();
|
||||
public int heat;
|
||||
|
||||
public HashSet<ChunkCoordinates> primary = new HashSet();
|
||||
public HashSet<ChunkCoordinates> secondary = new HashSet();
|
||||
|
||||
public TileEntitySolarBoiler() {
|
||||
water = new FluidTank(FluidType.WATER, 16000, 0);
|
||||
@ -50,6 +55,12 @@ public class TileEntitySolarBoiler extends TileEntity implements IFluidAcceptor,
|
||||
// System.out.println("*" + steam.getFill());
|
||||
|
||||
heat = 0;
|
||||
} else {
|
||||
|
||||
//a delayed queue of mirror positions because we can't expect the boiler to always tick first
|
||||
secondary.clear();
|
||||
secondary.addAll(primary);
|
||||
primary.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
|
||||
public class TileEntitySolarMirror extends TileEntityTickingBase {
|
||||
@ -49,6 +50,17 @@ public class TileEntitySolarMirror extends TileEntityTickingBase {
|
||||
TileEntitySolarBoiler boiler = (TileEntitySolarBoiler)te;
|
||||
boiler.heat += sun;
|
||||
}
|
||||
} else {
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(tX, tY - 1, tZ);
|
||||
|
||||
if(isOn && te instanceof TileEntitySolarBoiler) {
|
||||
TileEntitySolarBoiler boiler = (TileEntitySolarBoiler)te;
|
||||
boiler.primary.add(new ChunkCoordinates(xCoord, yCoord, zCoord));
|
||||
}
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0)
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,12 +111,12 @@ public class TileEntitySolarMirror extends TileEntityTickingBase {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 0.25,
|
||||
yCoord,
|
||||
zCoord - 0.25,
|
||||
xCoord + 1.25,
|
||||
yCoord + 1.5,
|
||||
zCoord + 1.25
|
||||
xCoord - 25,
|
||||
yCoord - 25,
|
||||
zCoord - 25,
|
||||
xCoord + 25,
|
||||
yCoord + 25,
|
||||
zCoord + 25
|
||||
);
|
||||
}
|
||||
|
||||
|
||||