watz core block, better hologram rendering

This commit is contained in:
Bob 2023-04-11 21:42:24 +02:00
parent 2debe1a0bf
commit 5246b7fad1
10 changed files with 219 additions and 7 deletions

View File

@ -823,6 +823,7 @@ public class ModBlocks {
public static Block struct_soyuz_core;
public static Block struct_iter_core;
public static Block struct_plasma_core;
public static Block struct_watz_core;
public static Block factory_titanium_hull;
@Deprecated public static Block factory_titanium_furnace;
@ -1950,6 +1951,7 @@ public class ModBlocks {
struct_soyuz_core = new BlockSoyuzStruct(Material.iron).setBlockName("struct_soyuz_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":struct_soyuz_core");
struct_iter_core = new BlockITERStruct(Material.iron).setBlockName("struct_iter_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_iter_core");
struct_plasma_core = new BlockPlasmaStruct(Material.iron).setBlockName("struct_plasma_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_plasma_core");
struct_watz_core = new BlockWatzStruct(Material.iron).setBlockName("struct_watz_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_watz_core");
factory_titanium_hull = new BlockGeneric(Material.iron).setBlockName("factory_titanium_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_titanium_hull");
factory_titanium_furnace = new FactoryHatch(Material.iron).setBlockName("factory_titanium_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_titanium_furnace");
@ -3221,6 +3223,7 @@ public class ModBlocks {
GameRegistry.registerBlock(struct_soyuz_core, struct_soyuz_core.getUnlocalizedName());
GameRegistry.registerBlock(struct_iter_core, struct_iter_core.getUnlocalizedName());
GameRegistry.registerBlock(struct_plasma_core, struct_plasma_core.getUnlocalizedName());
GameRegistry.registerBlock(struct_watz_core, struct_watz_core.getUnlocalizedName());
//Absorbers
GameRegistry.registerBlock(absorber, absorber.getUnlocalizedName());

View File

@ -17,9 +17,9 @@ public class BlockITERStruct extends BlockContainer {
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityITERStruct();
}
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@ -0,0 +1,25 @@
package com.hbm.blocks.machine;
import com.hbm.tileentity.machine.TileEntityWatzStruct;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockWatzStruct extends BlockContainer {
public BlockWatzStruct(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityWatzStruct();
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@ -314,6 +314,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySoyuzStruct.class, new RenderSoyuzMultiblock());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityITERStruct.class, new RenderITERMultiblock());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPlasmaStruct.class, new RenderPlasmaMultiblock());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWatzStruct.class, new RenderWatzMultiblock());
//RBMK
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKControlManual.class, new RenderRBMKControlRod());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKControlAuto.class, new RenderRBMKControlRod());

View File

@ -0,0 +1,62 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.render.util.SmallBlockPronter;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class RenderWatzMultiblock extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
bindTexture(TextureMap.locationBlocksTexture);
SmallBlockPronter.startDrawing();
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, 0F, 1F, 0F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, 0F, 2F, 0F);
for(int i = 0; i < 3; i++) {
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, 1F, i, 0F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, 2F, i, 0F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, 0F, i, 1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, 0F, i, 2F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, -1F, i, 0F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, -2F, i, 0F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, 0F, i, -1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, 0F, i, -2F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, 1F, i, 1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, 1F, i, -1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, -1F, i, 1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_element, 0, -1F, i, -1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, 2F, i, 1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, 2F, i, -1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, 1F, i, 2F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, -1F, i, 2F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, -2F, i, 1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, -2F, i, -1F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, 1F, i, -2F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_cooler, 0, -1F, i, -2F);
for(int j = -1; j < 2; j++) {
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_end, 0, 3F, i, j);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_end, 0, j, i, 3F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_end, 0, -3F, i, j);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_end, 0, j, i, -3F);
}
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_end, 0, 2F, i, 2F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_end, 0, 2F, i, -2F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_end, 0, -2F, i, 2F);
SmallBlockPronter.drawSmolBlockAt(ModBlocks.watz_end, 0, -2F, i, -2F);
}
SmallBlockPronter.draw();
GL11.glPopMatrix();
}
}

View File

@ -2,12 +2,16 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
public class RenderWatzPump extends TileEntitySpecialRenderer {
public class RenderWatzPump extends TileEntitySpecialRenderer implements IItemRendererProvider {
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
@ -26,4 +30,25 @@ public class RenderWatzPump extends TileEntitySpecialRenderer {
GL11.glPopMatrix();
}
@Override
public Item getItemForRenderer() {
return Item.getItemFromBlock(ModBlocks.watz_pump);
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -1.5, 0);
double scale = 5;
GL11.glScaled(scale, scale, scale);
}
public void renderCommon() {
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.watz_pump_tex);
ResourceManager.watz_pump.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}};
}
}

View File

@ -2,19 +2,26 @@ package com.hbm.render.util;
import org.lwjgl.opengl.GL11;
import com.hbm.interfaces.Spaghetti;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
public class SmallBlockPronter {
static float pixel = 1F/16F;
/**
* Bind the required texture yourself bruh
* Bind the required texture yourself bruh <- ding dong, 2023 bob speaking, fuck this guy
* @param loc
* @param x
* @param y
* @param z
*/
@Deprecated @Spaghetti("this is horseshit")
public static void renderSmolBlockAt(float x, float y, float z) {
GL11.glPushMatrix();
GL11.glTranslatef(x - 1, y - 1, z);
@ -64,4 +71,65 @@ public class SmallBlockPronter {
GL11.glPopMatrix();
}
public static void startDrawing() {
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_CULL_FACE);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDepthMask(false);
Tessellator.instance.startDrawingQuads();
}
public static void draw() {
Tessellator.instance.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_LIGHTING);
}
public static void drawSmolBlockAt(Block b, int meta, float x, float y, float z) {
Tessellator tesseract = Tessellator.instance;
IIcon iconTop = b.getIcon(ForgeDirection.UP.ordinal(), meta);
IIcon iconBottom = b.getIcon(ForgeDirection.DOWN.ordinal(), meta);
IIcon iconNorth = b.getIcon(ForgeDirection.NORTH.ordinal(), meta);
IIcon iconSouth = b.getIcon(ForgeDirection.SOUTH.ordinal(), meta);
IIcon iconEast = b.getIcon(ForgeDirection.EAST.ordinal(), meta);
IIcon iconWest = b.getIcon(ForgeDirection.WEST.ordinal(), meta);
tesseract.setNormal(0F, 1F, 0F);
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconSouth.getMaxU(), iconSouth.getMinV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconSouth.getMinU(), iconSouth.getMinV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconSouth.getMinU(), iconSouth.getMaxV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconSouth.getMaxU(), iconSouth.getMaxV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 11 * pixel / 2, iconEast.getMaxU(), iconEast.getMinV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconEast.getMinU(), iconEast.getMinV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconEast.getMinU(), iconEast.getMaxV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 11 * pixel / 2, z + 11 * pixel / 2, iconEast.getMaxU(), iconEast.getMaxV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 11 * pixel / 2, iconNorth.getMaxU(), iconNorth.getMinV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 11 * pixel / 2, iconNorth.getMinU(), iconNorth.getMinV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2,y + 11 * pixel / 2, z + 11 * pixel / 2, iconNorth.getMinU(), iconNorth.getMaxV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 11 * pixel / 2, z + 11 * pixel / 2, iconNorth.getMaxU(), iconNorth.getMaxV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconWest.getMaxU(), iconWest.getMinV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 11 * pixel / 2, iconWest.getMinU(), iconWest.getMinV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 11 * pixel / 2, z + 11 * pixel / 2, iconWest.getMinU(), iconWest.getMaxV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconWest.getMaxU(), iconWest.getMaxV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 11 * pixel / 2, iconTop.getMaxU(), iconTop.getMinV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 11 * pixel / 2, iconTop.getMinU(), iconTop.getMinV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconTop.getMinU(), iconTop.getMaxV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 1 - 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconTop.getMaxU(), iconTop.getMaxV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 11 * pixel / 2, z + 11 * pixel / 2, iconBottom.getMaxU(), iconBottom.getMinV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 11 * pixel / 2, z + 11 * pixel / 2, iconBottom.getMinU(), iconBottom.getMinV());
tesseract.addVertexWithUV(x + 1 - 11 * pixel / 2, y + 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconBottom.getMinU(), iconBottom.getMaxV());
tesseract.addVertexWithUV(x + 11 * pixel / 2, y + 11 * pixel / 2, z + 1 - 11 * pixel / 2, iconBottom.getMaxU(), iconBottom.getMaxV());
}
}

View File

@ -168,6 +168,7 @@ public class TileMappings {
put(TileEntityMachineFENSU.class, "tileentity_fensu");
put(TileEntityTrappedBrick.class, "tileentity_trapped_brick");
put(TileEntityPlasmaStruct.class, "tileentity_plasma_struct");
put(TileEntityWatzStruct.class, "tileentity_watz_struct");
put(TileEntityHadronDiode.class, "tileentity_hadron_diode");
put(TileEntityHadronPower.class, "tileentity_hadron_power");
put(TileEntityHadron.class, "tileentity_hadron");

View File

@ -0,0 +1,27 @@
package com.hbm.tileentity.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityWatzStruct extends TileEntity {
@Override
public void updateEntity() {
if(worldObj.isRemote)
return;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B