mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
the heinous slop
This commit is contained in:
parent
27bc38caaa
commit
ef228577d9
@ -2630,6 +2630,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(spotlight_halogen, spotlight_halogen.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(spotlight_halogen_off, spotlight_halogen_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(spotlight_beam, spotlight_beam.getUnlocalizedName());
|
||||
register(floodlight);
|
||||
|
||||
//Reinforced Blocks
|
||||
GameRegistry.registerBlock(asphalt, ItemBlockBlastInfo.class, asphalt.getUnlocalizedName());
|
||||
|
||||
@ -2,7 +2,14 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Floodlight extends BlockContainer {
|
||||
@ -19,8 +26,61 @@ public class Floodlight extends BlockContainer {
|
||||
@Override public int getRenderType() { return -1; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
//only method that respects sides, called first for orientation
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) {
|
||||
return side;
|
||||
}
|
||||
|
||||
//only method with player param, called second for variable rotation
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
float rotation = player.rotationPitch;
|
||||
|
||||
if(meta == 0 || meta == 1) {
|
||||
if(i == 0 || i == 2) world.setBlockMetadataWithNotify(x, y, z, meta + 6, 3);
|
||||
if(meta == 1) if(i == 0 || i == 1) rotation = 180F - rotation;
|
||||
if(meta == 0) if(i == 0 || i == 3) rotation = 180F - rotation;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityFloodlight) {
|
||||
TileEntityFloodlight floodlight = (TileEntityFloodlight) tile;
|
||||
floodlight.rotation = -Math.round(rotation / 5F) * 5F;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TileEntityFloodlight extends TileEntity {
|
||||
|
||||
public float rotation;
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.rotation = nbt.getFloat("rotation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setFloat("rotation", rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,6 +54,7 @@ import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter;
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.blocks.generic.BlockPedestal.TileEntityPedestal;
|
||||
import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe;
|
||||
import com.hbm.blocks.machine.Floodlight.TileEntityFloodlight;
|
||||
import com.hbm.blocks.machine.MachineFan.TileEntityFan;
|
||||
import com.hbm.blocks.machine.PistonInserter.TileEntityPistonInserter;
|
||||
import com.hbm.blocks.machine.WatzPump.TileEntityWatzPump;
|
||||
@ -184,6 +185,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecoBlockAltW.class, new RenderDecoBlockAlt());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecoBlockAltF.class, new RenderDecoBlockAlt());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDemonLamp.class, new RenderDemonLamp());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFloodlight.class, new RenderFloodlight());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLoot.class, new RenderLoot());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPedestal.class, new RenderPedestalTile());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBobble.class, new RenderBobble());
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.machine.Floodlight.TileEntityFloodlight;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.loader.HFRWavefrontObject;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
public class RenderFloodlight extends TileEntitySpecialRenderer {
|
||||
|
||||
public static final IModelCustom floodlight = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/blocks/floodlight.obj"));
|
||||
public static final ResourceLocation tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/floodlight.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D);
|
||||
|
||||
int meta = tileEntity.getBlockMetadata();
|
||||
switch(meta) {
|
||||
case 0: case 6: GL11.glRotated(180, 1, 0, 0); break;
|
||||
case 1: case 7: break;
|
||||
case 2: GL11.glRotated(90, 1, 0, 0); GL11.glRotated(180, 0, 0, 1); break;
|
||||
case 3: GL11.glRotated(90, 1, 0, 0); break;
|
||||
case 4: GL11.glRotated(90, 1, 0, 0); GL11.glRotated(90, 0, 0, 1); break;
|
||||
case 5: GL11.glRotated(90, 1, 0, 0); GL11.glRotated(270, 0, 0, 1); break;
|
||||
}
|
||||
|
||||
GL11.glTranslated(0, -0.5, 0);
|
||||
|
||||
if(meta != 0 && meta != 1) GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
bindTexture(tex);
|
||||
floodlight.renderPart("Base");
|
||||
|
||||
TileEntityFloodlight floodtile = (TileEntityFloodlight) tileEntity;
|
||||
float rotation = floodtile.rotation;
|
||||
if(meta == 0 || meta == 6) rotation -= 90;
|
||||
if(meta == 1 || meta == 7) rotation += 90;
|
||||
GL11.glTranslated(0, 0.5, 0);
|
||||
GL11.glRotatef(rotation, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.5, 0);
|
||||
|
||||
floodlight.renderPart("Lights");
|
||||
RenderArcFurnace.fullbright(true);
|
||||
floodlight.renderPart("Lamps");
|
||||
RenderArcFurnace.fullbright(false);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@ -16,7 +16,6 @@ import com.hbm.inventory.gui.GUIElectrolyserMetal;
|
||||
import com.hbm.inventory.material.MaterialShapes;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.recipes.CrystallizerRecipes;
|
||||
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes;
|
||||
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes.ElectrolysisRecipe;
|
||||
import com.hbm.inventory.recipes.ElectrolyserMetalRecipes;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 774 B |
Loading…
x
Reference in New Issue
Block a user