This commit is contained in:
Boblet 2026-04-24 12:03:31 +02:00
parent 7f6e61b48a
commit 338fc44ae5
6 changed files with 168 additions and 476 deletions

View File

@ -1,503 +1,196 @@
package com.hbm.blocks.test; package com.hbm.blocks.test;
import java.util.HashMap; import org.lwjgl.input.Mouse;
import java.util.List; import org.lwjgl.opengl.GL11;
import java.util.Map;
import java.util.Random;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.Block; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentProtection; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
public class TestEventTester extends Block { public class TestEventTester extends BlockContainer {
public float explosionSize = 1000F; public static final int SLOT_CLICK_ID_REFRESH = -666;
private Map field_77288_k = new HashMap();
protected static Random itemRand = new Random();
public World worldObj;
public TestEventTester(Material p_i45394_1_) { public TestEventTester(Material mat) {
super(p_i45394_1_); super(mat);
} }
@Override @Override
public void onNeighborBlockChange(World p_149695_1_, int x1, int y1, int z1, Block p_149695_5_) public TileEntity createNewTileEntity(World worlb, int mettaton) {
{ return new TileEntityTestStorage();
this.worldObj = p_149695_1_;
//Levers and buttons for some reason set meta and notify, and *then* notify again, meaning they will always fire this twice.
//Pressure plates, torches, redstone, etc. do not have this issue.
if (p_149695_1_.isBlockIndirectlyGettingPowered(x1, y1, z1))
{
/*Component comp = new SiloComponent(this.worldObj.rand, x1, z1);
StructureBoundingBox box = comp.getBoundingBox();
box.minY = 0;
box.maxY = 512;
comp.addComponentParts(p_149695_1_, this.worldObj.rand, box);*/
//The laser thread is too dangerous to use right now
//ThreadLaser laser = new ThreadLaser(p_149695_1_, x, y, z, "north");
//laser.start();
//ExplosionChaos.frag(p_149695_1_, x, y + 2, z, 10, false, null);
//EntitySmokeFX smoke = new EntitySmokeFX(p_149695_1_, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0);
//p_149695_1_.spawnEntityInWorld(smoke);
//ExplosionParticle.spawnMush(p_149695_1_, x, y, z);
//mirv(this.worldObj, x, y + 20, z);
//killEvent(p_149695_1_, x, y, z);
/*EntityNuclearCreeper e = new EntityNuclearCreeper(p_149695_1_);
e.posX = x;
e.posY = y + 1;
e.posZ = z;
if(!p_149695_1_.isRemote)
{
p_149695_1_.spawnEntityInWorld(e);
} }
/*if(p_149695_1_.isRemote)
{
ExplosionNukeAdvanced.mush(p_149695_1_, x, y, z);
}*/
/*EntityFalloutRain fallout = new EntityFalloutRain(p_149695_1_, 1000);
fallout.posX = x;
fallout.posY = y + 3;
fallout.posZ = z;
fallout.setScale(50);
p_149695_1_.spawnEntityInWorld(fallout);*/
//worldObj.setBlock(x, y, z, Blocks.air);
//ExplosionLarge.explode(worldObj, x + 0.5, y + 0.5, z + 0.5, MainRegistry.x, true, true, true);
/*EntityBlackHole bl = new EntityBlackHole(worldObj, MainRegistry.x * 0.1F);
bl.posX = x + 0.5F;
bl.posY = y + 0.5F;
bl.posZ = z + 0.5F;
worldObj.spawnEntityInWorld(bl);*/
/*if(!worldObj.isRemote)
{
try {
Chunk oldChunk = worldObj.getChunkFromBlockCoords(x1, z1);
if(worldObj instanceof WorldServer)
{
WorldServer worldServer = (WorldServer) worldObj;
ChunkProviderServer chunkProviderServer = worldServer.theChunkProviderServer;
IChunkProvider chunkProviderGenerate = chunkProviderServer.currentChunkProvider;
Chunk newChunk = chunkProviderGenerate.provideChunk(oldChunk.xPosition, oldChunk.zPosition);
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
{
for (int y = 0; y < worldObj.getHeight(); y++)
{
Block block = newChunk.getBlock(x, y, z);
int metadata = newChunk.getBlockMetadata(x, y, z);
worldServer.setBlock(x + oldChunk.xPosition * 16, y, z + oldChunk.zPosition * 16, block, metadata, 2);
TileEntity tileEntity = newChunk.getTileEntityUnsafe(x, y, z);
if(tileEntity != null)
{
worldServer.setTileEntity(x + oldChunk.xPosition * 16, y, z + oldChunk.zPosition * 16, tileEntity);
}
}
}
}
oldChunk.isTerrainPopulated = false;
chunkProviderGenerate.populate(chunkProviderGenerate, oldChunk.xPosition, oldChunk.zPosition);
}
} catch(Exception e) {
System.out.println("Rejuvenation Failed!");
e.printStackTrace();
}
}*/
/*if(!worldObj.isRemote) {
switch(itemRand.nextInt(3)) {
case 0:
(new Meteorite()).generateLarge(worldObj, itemRand, x1, y1, z1);
break;
case 1:
(new Meteorite()).generateMedium(worldObj, itemRand, x1, y1, z1);
break;
case 2:
(new Meteorite()).generateSmall(worldObj, itemRand, x1, y1, z1);
break;
}
}*/
/*if(!worldObj.isRemote) {
EntityMeteor met = new EntityMeteor(worldObj);
met.posX = x1;
met.posY = 300;
met.posZ = z1;
worldObj.spawnEntityInWorld(met);
worldObj.setBlockToAir(x1, y1, z1);
}*/
/*if(!worldObj.isRemote) {
ModEventHandler.meteorShower = 6000;
}*/
/*EntityCloudFleija rainbow = new EntityCloudFleija(worldObj);
rainbow.posX = x1;
rainbow.posY = y1;
rainbow.posZ = z1;
rainbow.maxAge = 100;
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(rainbow);*/
/*RadiationSavedData data = RadiationSavedData.getData(worldObj);
//ALU SETS RAD TO 1000
//BER PRINTS RAD LEVEL
//COP INITIATES CYCLE
//RED FLUSHES ALL RAD
//STE PRINTS RAD CHUNKS
//URA PRINTS TOTAL RAD
//THO SETS RAD TO 1000000
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_aluminium) {
Chunk chunk = worldObj.getChunkFromBlockCoords(x1, z1);
data.setRadForCoord(chunk.xPosition, chunk.zPosition, 1000);
System.out.println(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition));
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_beryllium) {
Chunk chunk = worldObj.getChunkFromBlockCoords(x1, z1);
System.out.println(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition));
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_copper) {
data.updateSystem();
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_red_copper) {
data.jettisonData();
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_steel) {
System.out.println(data.contamination.size());
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_uranium) {
float r = 0;
for(Entry<ChunkCoordIntPair, Float> struct : data.contamination.entrySet()) {
r += struct.getValue();
}
System.out.println(r);
}
if(worldObj.getBlock(x1, y1 - 1, z1) == ModBlocks.block_thorium) {
Chunk chunk = worldObj.getChunkFromBlockCoords(x1, z1);
data.setRadForCoord(chunk.xPosition, chunk.zPosition, 1000000);
System.out.println(data.getRadNumFromCoord(chunk.xPosition, chunk.zPosition));
}
if(!worldObj.isRemote) {
worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFac(worldObj, x1, y1 + 5, z1, 100));
worldObj.setBlockToAir(x1, y1, z1);
}*/
}
}
/*public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
this.worldObj = world;
if(world.isRemote)
{
return true;
} else if(!player.isSneaking())
{
//killEvent(world, x, y, z);
world.spawnParticle("smoke", (double)x, (double)y + 1, (double)z, 0.0D, 1.0D, 0.0D);
return true;
} else {
return false;
}
}*/
@Override @Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) public boolean onBlockActivated(World worlb, int x, int y, int z, EntityPlayer playor, int side, float hitX, float hitY, float hitZ) {
{ if(!worlb.isRemote) FMLNetworkHandler.openGui(playor, MainRegistry.instance, 0, worlb, x, y, z);
this.worldObj = par1World;
/*double d = (float)par2 + 0.5F;
double d1 = (float)par3 + 0.7F;
double d2 = (float)par4 + 0.5F;
double d3 = 0.2199999988079071D;
double d4 = 0.27000001072883606D;
par1World.spawnParticle("smoke", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
//Minecraft.getMinecraft().effectRenderer.addEffect(new NukeSmokeFX(par1World, d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 100, 100));
//NukeCloudFX part = new NukeCloudFX(par1World, d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 100);
//part.
//Minecraft.getMinecraft().effectRenderer.addEffect(part);
{
return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
if(par1World.isRemote)
{
ExplosionNukeAdvanced.mush(par1World, par2, par3, par4);
}
}*/
//ExplosionThutmose splosion = new ExplosionThutmose(par1World, null, (double) par2 + 0.5D, (double) par3 + 0.5D, (double) par4 + 0.5D, 10);
//splosion.doExplosion();
//par1World.setBlock(par2, par3, par4, Blocks.air);
//ExplosionChaos.anvil(par1World, par2, par3 + 2, par4, 1);
//return true;
//System.out.println(par5EntityPlayer.getCommandSenderName());
//System.out.println(par5EntityPlayer.getUniqueID());
/*List<ItemStack> list = new ArrayList<ItemStack>();
PotionEffect effect = new PotionEffect(PotionEffectTaint.instance.id, 300, 0);
effect.setCurativeItems(list);
par5EntityPlayer.addPotionEffect(effect);
return true;*/
/*if(!worldObj.isRemote) {
SatelliteSavedData data = (SatelliteSavedData)worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites");
if(data == null) {
worldObj.perWorldStorage.setData("satellites", new SatelliteSavedData(worldObj));
return true; return true;
} }
for(SatelliteSaveStructure sat : data.satellites) { public static class TileEntityTestStorage extends TileEntityMachineBase implements IGUIProvider {
par5EntityPlayer.addChatComponentMessage(new ChatComponentText(sat.satelliteID + ": " + sat.satelliteType.name()));
}
data.markDirty();
}*/
public TileEntityTestStorage() {
/*if(!worldObj.isRemote) super(8 * 50); // just eat fucking shit at this point
buildEvent(worldObj, par2, par3, par4, 30);*/
/*((EntityLivingBase)par5EntityPlayer).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 100, 0));*/
/*worldObj.setBlockToAir(par2, par3, par4);
(new Sellafield()).generate(worldObj, par2, par4, 50D, 15D);*/
/*switch(itemRand.nextInt(3)) {
case 0:
worldObj.playSoundEffect(par2, par3, par4, "hbm:fm.clap", 1.0F, 1.0F); break;
case 1:
worldObj.playSoundEffect(par2, par3, par4, "hbm:fm.mug", 1.0F, 1.0F); break;
case 2:
worldObj.playSoundEffect(par2, par3, par4, "hbm:fm.sample", 1.0F, 1.0F); break;
}*/
/*worldObj.setBlockToAir(par2, par3, par4);
new Barrel().generate(worldObj, worldObj.rand, par2, par3, par4);*/
/*worldObj.setBlock(par2, par3, par4, ModBlocks.crate_steel, 0, 3);
if(worldObj.getBlock(par2, par3, par4) == ModBlocks.crate_steel)
{
WeightedRandomChestContent.generateChestContents(worldObj.rand, HbmChestContents.getLoot(3), (TileEntityCrateSteel)worldObj.getTileEntity(par2, par3, par4), 32);
}*/
/*EntityBurningFOEQ foeq = new EntityBurningFOEQ(worldObj);
foeq.posX = par2;
foeq.posY = 400;
foeq.posZ = par4;
foeq.motionX = worldObj.rand.nextGaussian() * 1D;
foeq.motionZ = worldObj.rand.nextGaussian() * 1D;
foeq.motionY = -4D;
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(foeq);*/
/*if(!worldObj.isRemote) {
worldObj.setBlockToAir(par2, par3, par4);
ExplosionLarge.jolt(worldObj, par2 - 0.5, par3 - 0.5, par4 - 0.5, 5, 200, 0.25);
ExplosionLarge.explode(worldObj, par2 + 0.5, par3 + 0.5, par4 + 0.5, 5, false, false, false);
}*/
/*if(!worldObj.isRemote) {
EntityMinerRocket rocket = new EntityMinerRocket(worldObj);
rocket.posX = par2 + 0.5;
rocket.posY = 100;
rocket.posZ = par4 + 0.5;
worldObj.spawnEntityInWorld(rocket);
}*/
/*if(!worldObj.isRemote) {
EntityEMP emp = new EntityEMP(worldObj);
emp.posX = par2 + 0.5;
emp.posY = par3 + 0.5;
emp.posZ = par4 + 0.5;
worldObj.spawnEntityInWorld(emp);
}*/
/*if(!worldObj.isRemote) {
new GeyserLarge().generate(worldObj, itemRand, par2, par3, par4);
}*/
/*if(!worldObj.isRemote)
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(par2, par3 + 2, par4, 2),
new TargetPoint(worldObj.provider.dimensionId,par2, par3, par4, 50));*/
/*if(!worldObj.isRemote) {
EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldObj, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this, worldObj.getBlockMetadata(par2, par3, par4));
worldObj.spawnEntityInWorld(entityfallingblock);
}*/
/*if(!worldObj.isRemote) {
EntityCloudTom tom = new EntityCloudTom(worldObj, 100);
tom.setPosition(par2 + 0.5, par3 + 2, par4 + 0.5);
worldObj.spawnEntityInWorld(tom);
}*/
/*if(!worldObj.isRemote) {
worldObj.setBlockToAir(par2, par3, par4);
ExplosionNT ex = new ExplosionNT(worldObj, null, par2 + 0.5, par3 + 2, par4 + 0.5, 5);
ex.addAttrib(ExAttrib.ALLDROP);
ex.doExplosionA();
ex.doExplosionB(false);
}*/
FMLNetworkHandler.openGui(par5EntityPlayer, MainRegistry.instance, -1, par1World, par2, par3, par4);
return true;
} }
public void buildEvent(World world, int x, int y, int z, int r) { @Override public String getName() { return "Balls"; }
@Override public void updateEntity() { }
Random rand = new Random(); @Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerTestStorage(player.inventory, this); }
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUITestStorage(player.inventory, this); }
for(double h = r; h >= -r; h -= (0.2D + ((r - Math.abs(h)) / r * 0.6D))) {
double sectionRad = Math.sqrt(Math.pow(r, 2) - Math.pow(h, 2));
double circumference = 4 * Math.PI * sectionRad + rand.nextGaussian() * 0.5 + 0.25D;
System.out.println(h + " " + circumference);
for(int c = 0; c < circumference; c++) {
Vec3 vec = Vec3.createVectorHelper(sectionRad, h, 0);
vec = vec.normalize();
//vec.rotateAroundZ((float) (h / sectionRad) * -2);
vec.rotateAroundY((float) (360 / circumference * c));
int dX = (int) Math.round(vec.xCoord * r + x);
int dY = (int) Math.round(vec.yCoord * r + y);
int dZ = (int) Math.round(vec.zCoord * r + z);
world.setBlock(dX, dY, dZ, Blocks.gold_block);
}
}
} }
public void killEvent(World world, int x, int y, int z) { public static class ContainerTestStorage extends Container {
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.break", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); protected TileEntityTestStorage tile;
float f = this.explosionSize;
int i;
int j;
int k;
double d5;
double d6;
double d7;
double wat = 20.0D;
public ContainerTestStorage(InventoryPlayer invPlayer, TileEntityTestStorage tile) {
this.explosionSize *= 2.0F; this.tile = tile;
i = MathHelper.floor_double(x - wat - 1.0D); setupWithScroll(tile, invPlayer, 0);
j = MathHelper.floor_double(x + wat + 1.0D);
k = MathHelper.floor_double(y - wat - 1.0D);
int i2 = MathHelper.floor_double(y + wat + 1.0D);
int l = MathHelper.floor_double(z - wat - 1.0D);
int j2 = MathHelper.floor_double(z + wat + 1.0D);
List list = world.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(i, k, l, j, i2, j2));
Vec3 vec4 = Vec3.createVectorHelper(x, y + 1, z);
for (int i1 = 0; i1 < list.size(); ++i1)
{
Entity entity = (Entity)list.get(i1);
double d4 = entity.getDistance(x, y, z) / this.explosionSize;
if (d4 <= 1.0D)
{
d5 = entity.posX - x;
d6 = entity.posY + entity.getEyeHeight() - y;
d7 = entity.posZ - z;
double d9 = MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7);
if (d9 < wat)
{
d5 /= d9;
d6 /= d9;
d7 /= d9;
double d10 = world.getBlockDensity(vec4, entity.boundingBox);
double d11 = (1.0D - d4) * d10;
//entity.attackEntityFrom(DamageSource.generic, (float)(100 - d9/wat*100/d10));
if(!entity.worldObj.isRemote && !entity.isDead)
{
entity.setFire(50);
//entity.setDead();
} }
//entity.attackEntityFrom(DamageSource.generic, (float)((int)((d11 * d11 + d11) / 2.0D * 8.0D * (double)this.explosionSize + 1.0D))); @Override
double d8 = EnchantmentProtection.func_92092_a(entity, d11); public ItemStack slotClick(int slotIndex, int button, int mode, EntityPlayer player) {
entity.motionX += d5 * d8;
entity.motionY += d6 * d8;
entity.motionZ += d7 * d8;
if (entity instanceof EntityPlayer) if(slotIndex == SLOT_CLICK_ID_REFRESH) {
{ this.setupWithScroll(tile, player.inventory, mode);
this.field_77288_k.put(entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11)); return null;
} }
return super.slotClick(slotIndex, button, mode, player);
} }
public void setupWithScroll(TileEntityTestStorage tile, InventoryPlayer invPlayer, int rowOffset) {
this.inventorySlots.clear();
this.inventoryItemStacks.clear();
for(int row = 0; row < 6; row++) {
for(int col = 0; col < 8; col++) {
int index = col + (row + rowOffset) * 8;
if(index >= tile.slots.length) continue;
this.addSlotToContainer(new Slot(tile, index, 8 + col * 18, 18 + row * 18));
} }
} }
this.explosionSize = f; 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, 140 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 198));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
return null;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return tile.isUseableByPlayer(player);
}
}
public static class GUITestStorage extends GuiContainer {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_test_storage.png");
protected int scrollIndex = 0;
protected static final int scrollBounds = (50 - 7); // 50 rows total, minus 6 visible rows, minus 1 because we start at index 0
protected boolean wasClicking = false;
protected boolean draggingScroll = false;
public GUITestStorage(InventoryPlayer invPlayer, TileEntityTestStorage tile) {
super(new ContainerTestStorage(invPlayer, tile));
this.xSize = 176;
this.ySize = 222;
}
@Override
public void drawScreen(int x, int y, float interp) {
boolean isClicking = Mouse.isButtonDown(0);
if(!isClicking) this.draggingScroll = false;
if(!wasClicking && isClicking && guiLeft + 153 <= x && guiLeft + 153 + 14 > x && guiTop + 17 < y && guiTop + 17 + 108 >= y) {
draggingScroll = true;
}
if(draggingScroll) {
int range = 92; // 106 scroll bar size, -7 pixels on top and bottom
int sY = MathHelper.clamp_int(y - guiTop - 25, 0, 92);
double scrollFrac = (double) sY / (double) range;
int row = (int) (scrollBounds * scrollFrac);
this.setScroll(row);
}
this.wasClicking = isClicking;
super.drawScreen(x, y, interp);
}
@Override
protected void drawGuiContainerBackgroundLayer(float interp, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
drawTexturedModalRect(guiLeft + getScrollBarXPos(), guiTop + getScrollBarYPos(), draggingScroll ? 188 : 176, 0, 12, 15);
}
@Override
public void handleMouseInput() {
super.handleMouseInput();
int scrollDir = Mouse.getEventDWheel();
if(scrollDir != 0) {
if(scrollDir > 0) scrollDir = 1;
if(scrollDir < 0) scrollDir = -1;
this.setScroll(this.getScroll() - scrollDir);
}
}
public int getScrollBarXPos() {
return 154;
}
public int getScrollBarYPos() {
int scrollArea = 106 - 15; // bar height minus the scroll knob's height
double scrollProgress = (double) scrollIndex / (double) scrollBounds;
int scrollYPos = 18 + (int) (scrollProgress * scrollArea);
return scrollYPos;
}
public int getScroll() {
return MathHelper.clamp_int(scrollIndex, 0, scrollBounds);
}
public void setScroll(int scroll) {
int prevScroll = getScroll();
this.scrollIndex = MathHelper.clamp_int(scroll, 0, scrollBounds);
if(prevScroll != this.scrollIndex) refreshContainer();
}
public void refreshContainer() {
this.mc.playerController.windowClick(this.inventorySlots.windowId, SLOT_CLICK_ID_REFRESH, 0, this.scrollIndex, this.mc.thePlayer);
}
} }
} }

View File

@ -52,9 +52,6 @@ public class TileEntityLoadedBase extends TileEntity implements ILoadedTile, IBu
super.readFromNBT(nbt); super.readFromNBT(nbt);
this.muffled = nbt.getBoolean("muffled"); this.muffled = nbt.getBoolean("muffled");
this.tilted = nbt.getBoolean("tilted"); this.tilted = nbt.getBoolean("tilted");
// one more for good measure
if(this instanceof IFluidUserMK2) markChanged();
} }
@Override @Override

View File

@ -44,6 +44,7 @@ import com.hbm.blocks.network.FluidDuctPaintableBlockExhaust.TileEntityPipeExhau
import com.hbm.blocks.network.FluidPump.TileEntityFluidPump; import com.hbm.blocks.network.FluidPump.TileEntityFluidPump;
import com.hbm.blocks.network.PneumoTubePaintableBlock.TileEntityPneumoTubePaintable; import com.hbm.blocks.network.PneumoTubePaintableBlock.TileEntityPneumoTubePaintable;
import com.hbm.blocks.rail.RailStandardSwitch.TileEntityRailSwitch; import com.hbm.blocks.rail.RailStandardSwitch.TileEntityRailSwitch;
import com.hbm.blocks.test.TestEventTester.TileEntityTestStorage;
import com.hbm.blocks.network.BlockOpenComputersCablePaintable.TileEntityOpenComputersCablePaintable; import com.hbm.blocks.network.BlockOpenComputersCablePaintable.TileEntityOpenComputersCablePaintable;
import com.hbm.tileentity.bomb.*; import com.hbm.tileentity.bomb.*;
import com.hbm.tileentity.deco.*; import com.hbm.tileentity.deco.*;
@ -68,6 +69,7 @@ public class TileMappings {
public static void writeMappings() { public static void writeMappings() {
put(TileEntityDiFurnace.class, "tilentity_diFurnace"); put(TileEntityDiFurnace.class, "tilentity_diFurnace");
put(TileEntityTestStorage.class, "tilentity_test_storage");
put(TileEntityObjTester.class, "tilentity_objtester"); put(TileEntityObjTester.class, "tilentity_objtester");
put(TileEntityMachineCentrifuge.class, "tileentity_centrifuge"); put(TileEntityMachineCentrifuge.class, "tileentity_centrifuge");
put(TileEntityNukeMan.class, "tileentity_nukeman"); put(TileEntityNukeMan.class, "tileentity_nukeman");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB