mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
small test involving jars
This commit is contained in:
parent
8e1b32cb42
commit
9c57c73d11
34
src/main/java/com/hbm/wiaj/FauxWorld.java
Normal file
34
src/main/java/com/hbm/wiaj/FauxWorld.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.hbm.wiaj;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.storage.SaveHandlerMP;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FauxWorld extends World {
|
||||
|
||||
public FauxWorld(String p_i45368_2_, WorldProvider p_i45368_3_, WorldSettings p_i45368_4_, Profiler p_i45368_5_) {
|
||||
super(new SaveHandlerMP(), "FauxWorld", p_i45368_3_, p_i45368_4_, p_i45368_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IChunkProvider createChunkProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int func_152379_p() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getEntityByID(int id) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
8
src/main/java/com/hbm/wiaj/GuiWorldInAJar.java
Normal file
8
src/main/java/com/hbm/wiaj/GuiWorldInAJar.java
Normal file
@ -0,0 +1,8 @@
|
||||
package com.hbm.wiaj;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
//krass
|
||||
public class GuiWorldInAJar extends GuiScreen {
|
||||
|
||||
}
|
||||
6
src/main/java/com/hbm/wiaj/ITileActorRenderer.java
Normal file
6
src/main/java/com/hbm/wiaj/ITileActorRenderer.java
Normal file
@ -0,0 +1,6 @@
|
||||
package com.hbm.wiaj;
|
||||
|
||||
public interface ITileActorRenderer {
|
||||
|
||||
public void renderActor(Object... data);
|
||||
}
|
||||
109
src/main/java/com/hbm/wiaj/WorldInAJar.java
Normal file
109
src/main/java/com/hbm/wiaj/WorldInAJar.java
Normal file
@ -0,0 +1,109 @@
|
||||
package com.hbm.wiaj;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* A hastily put together implementation of IBlockAccess in order to render things using ISBRH...
|
||||
* It can handle blocks, and not a whole lot else.
|
||||
* @author hbm
|
||||
*/
|
||||
public class WorldInAJar implements IBlockAccess {
|
||||
|
||||
private int sizeX;
|
||||
private int sizeY;
|
||||
private int sizeZ;
|
||||
|
||||
private Block[][][] blocks;
|
||||
private short[][][] meta;
|
||||
private TileEntity[][][] tiles;
|
||||
|
||||
public WorldInAJar(int x, int y, int z) {
|
||||
this.sizeX = x;
|
||||
this.sizeY = y;
|
||||
this.sizeZ = z;
|
||||
|
||||
this.blocks = new Block[x][y][z];
|
||||
this.meta = new short[x][y][z];
|
||||
this.tiles = new TileEntity[x][y][z];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
if(x < 0 || x >= sizeX || y < 0 || y >= sizeY || z < 0 || z >= sizeZ)
|
||||
return Blocks.air;
|
||||
|
||||
return this.blocks[x][y][z] != null ? this.blocks[x][y][z] : Blocks.air;
|
||||
}
|
||||
|
||||
public void setBlock(int x, int y, int z, Block b, int meta) {
|
||||
if(x < 0 || x >= sizeX || y < 0 || y >= sizeY || z < 0 || z >= sizeZ)
|
||||
return;
|
||||
|
||||
this.blocks[x][y][z] = b;
|
||||
this.meta[x][y][z] = (short) Math.abs(meta % 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z) {
|
||||
if(x < 0 || x >= sizeX || y < 0 || y >= sizeY || z < 0 || z >= sizeZ)
|
||||
return 0;
|
||||
|
||||
return this.meta[x][y][z];
|
||||
}
|
||||
|
||||
//shaky, we may kick tile entities entirely and rely on outside-the-world tile actors for rendering
|
||||
//might still come in handy for manipulating things using dummy tiles, like cable connections
|
||||
@Override
|
||||
public TileEntity getTileEntity(int x, int y, int z) {
|
||||
if(x < 0 || x >= sizeX || y < 0 || y >= sizeY || z < 0 || z >= sizeZ)
|
||||
return null;
|
||||
|
||||
TileEntity tile = this.tiles[x][y][z];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//always render fullbright, if the situation requires it we could add a very rudimentary system that
|
||||
//darkens blocks id there is a solid one above
|
||||
@Override
|
||||
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int blockBrightness) {
|
||||
return 15; //always be on fullbright
|
||||
}
|
||||
|
||||
//redstone could theoretically be implemented, but we will wait for now
|
||||
@Override
|
||||
public int isBlockProvidingPowerTo(int x, int y, int z, int dir) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAirBlock(int x, int y, int z) {
|
||||
return this.getBlock(x, y, z).isAir(this, x, y, z);
|
||||
}
|
||||
|
||||
//biomes don't matter to us, if the situation requires it we could implement a primitive biome mask
|
||||
@Override
|
||||
public BiomeGenBase getBiomeGenForCoords(int x, int z) {
|
||||
return BiomeGenBase.plains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return this.sizeY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean extendedLevelsInChunkCache() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) {
|
||||
return getBlock(x, y, z).isSideSolid(this, x, y, z, side);
|
||||
}
|
||||
}
|
||||
31
src/main/java/com/hbm/wiaj/actions/ActionSetBlock.java
Normal file
31
src/main/java/com/hbm/wiaj/actions/ActionSetBlock.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.hbm.wiaj.actions;
|
||||
|
||||
import com.hbm.wiaj.WorldInAJar;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class ActionSetBlock implements IWorldAction {
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
Block b;
|
||||
int meta;
|
||||
|
||||
public ActionSetBlock(int x, int y, int z, Block b) {
|
||||
this(x, y, z, b, 0);
|
||||
}
|
||||
|
||||
public ActionSetBlock(int x, int y, int z, Block b, int meta) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.b = b;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(WorldInAJar world) {
|
||||
world.setBlock(x, y, z, b, meta);
|
||||
}
|
||||
}
|
||||
8
src/main/java/com/hbm/wiaj/actions/IWorldAction.java
Normal file
8
src/main/java/com/hbm/wiaj/actions/IWorldAction.java
Normal file
@ -0,0 +1,8 @@
|
||||
package com.hbm.wiaj.actions;
|
||||
|
||||
import com.hbm.wiaj.WorldInAJar;
|
||||
|
||||
public interface IWorldAction {
|
||||
|
||||
public void act(WorldInAJar world);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user