cram it in a jar

This commit is contained in:
Bob 2022-08-22 22:02:18 +02:00
parent 9c57c73d11
commit 1a1be50d3d
4 changed files with 124 additions and 7 deletions

View File

@ -8,6 +8,9 @@ import java.util.Map.Entry;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentProtection;
@ -395,10 +398,8 @@ public class TestEventTester extends Block {
ex.doExplosionB(false);
}*/
if(!worldObj.isRemote) {
worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFacBale(worldObj, par2, par3 + 5, par4, 100, 0));
}
FMLNetworkHandler.openGui(par5EntityPlayer, MainRegistry.instance, -1, par1World, par2, par3, par4);
return true;
}

View File

@ -17,6 +17,7 @@ import com.hbm.tileentity.machine.oil.*;
import com.hbm.tileentity.machine.rbmk.*;
import com.hbm.tileentity.machine.storage.*;
import com.hbm.tileentity.turret.*;
import com.hbm.wiaj.GuiWorldInAJar;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@ -843,6 +844,8 @@ public class GUIHandler implements IGuiHandler {
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
if(ID == -1) return new GuiWorldInAJar();
if(entity instanceof IGUIProvider) {
return ((IGUIProvider) entity).provideGUI(ID, player, world, x, y, z);
}

View File

@ -1,8 +1,117 @@
package com.hbm.wiaj;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
//krass
public class GuiWorldInAJar extends GuiScreen {
WorldInAJar world;
RenderBlocks renderer;
public GuiWorldInAJar() {
super();
world = new WorldInAJar(15, 15, 15);
renderer = new RenderBlocks(world);
renderer.enableAO = true;
for(int x = 0; x < 15; x++) {
for(int y = 0; y < 15; y++) {
for(int z = 0; z < 15; z++) {
if(y == 14) {
world.setBlock(x, y, z, ModBlocks.glass_boron, 0);
continue;
}
if(y > 0) {
if(x == 0 || x == 14 || z == 0 || z == 14) {
world.setBlock(x, y, z, ModBlocks.glass_boron, 0);
continue;
}
}
if(y == 0) {
if(x == 0 || x == 14 || z == 0 || z == 14) {
world.setBlock(x, y, z, ModBlocks.concrete_colored, 6);
} else {
world.setBlock(x, y, z, ModBlocks.concrete_smooth, 0);
}
}
}
}
}
world.setBlock(2, 1, 2, ModBlocks.fallout, 0);
world.setBlock(4, 1, 4, ModBlocks.conveyor, 2);
world.setBlock(4, 1, 5, ModBlocks.conveyor, 2);
world.setBlock(4, 1, 6, ModBlocks.conveyor, 2);
world.setBlock(4, 1, 7, ModBlocks.conveyor, 2);
world.setBlock(4, 1, 8, ModBlocks.conveyor, 2);
world.setBlock(4, 1, 9, ModBlocks.conveyor, 2);
world.setBlock(4, 1, 10, ModBlocks.conveyor, 6);
world.setBlock(5, 1, 10, ModBlocks.conveyor, 4);
for(int x = 9; x < 12; x++) {
for(int y = 1; y < 5; y++) {
for(int z = 6; z < 9; z++) {
world.setBlock(x, y, z, Blocks.brick_block, 0);
}
}
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
this.drawDefaultBackground();
this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
GL11.glDisable(GL11.GL_LIGHTING);
//this.drawGuiContainerForegroundLayer(mouseX, mouseY);
GL11.glEnable(GL11.GL_LIGHTING);
}
private void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
GL11.glPushMatrix();
double scale = -10;
GL11.glTranslated(width / 2, height / 2 + 70, 100);
GL11.glScaled(scale, scale, scale);
GL11.glScaled(1, 1, 0.01); // increadible flattening power
GL11.glRotated(30, -1, 0, 0);
GL11.glRotated(45, 0, -1, 0);
GL11.glTranslated(-7, 0 , -7);
GL11.glTranslated(world.sizeX / 2D, 0 , world.sizeZ / 2D);
GL11.glRotated(System.currentTimeMillis() % (360 * 20) / 20D, 0, -1, 0);
GL11.glTranslated(world.sizeX / -2D, 0 , world.sizeZ / -2D);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator.instance.startDrawingQuads();
for(int x = 0; x < world.sizeX; x++) {
for(int y = 0; y < world.sizeY; y++) {
for(int z = 0; z < world.sizeZ; z++) {
renderer.renderBlockByRenderType(world.getBlock(x, y, z), x, y, z);
}
}
}
Tessellator.instance.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}

View File

@ -1,5 +1,7 @@
package com.hbm.wiaj;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
@ -14,9 +16,9 @@ import net.minecraftforge.common.util.ForgeDirection;
*/
public class WorldInAJar implements IBlockAccess {
private int sizeX;
private int sizeY;
private int sizeZ;
public int sizeX;
public int sizeY;
public int sizeZ;
private Block[][][] blocks;
private short[][][] meta;
@ -88,11 +90,13 @@ public class WorldInAJar implements IBlockAccess {
//biomes don't matter to us, if the situation requires it we could implement a primitive biome mask
@Override
@SideOnly(Side.CLIENT)
public BiomeGenBase getBiomeGenForCoords(int x, int z) {
return BiomeGenBase.plains;
}
@Override
@SideOnly(Side.CLIENT)
public int getHeight() {
return this.sizeY;
}