Jump to content

Odd world.isRemote difference between two custom machines


TrekkieCub314

Recommended Posts

I'm having an odd problem with a couple of machines (well, only one really) that I've added to the game.  One is a rock crusher, the other is an immersion tank.  The rock crusher is working perfectly, while the immersion tank is having an odd problem.  After messing around with the blocks a while, it seems that the problem is in the corresponding TileEntity's updateEntity function.  Specifically, when checking to see if the world is remote or not, the rock crusher gets one result whereas the immersion tank gets a different result.  I've been looking through the code for all of the files I've made and can't find where the difference between the blocks is at.  I thought maybe it was due to how the external textures are being handled by either block (rock crusher is using the vanilla furnace method where the block is replaced with a slightly different block while processing an item, whereas the immersion tank is using a custom renderer), but after modifying the latter to match the former, I'm still having the same problem.

 

Has this happened to anyone else?  Does anyone know how to fix this?

 

Since I'm not sure where the problem is, I'm including every file even remotely related to the machines.

 

[spoiler=Block_Rock_Crusher]

package com.trekkiecub.allthethings;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.item.EntityItem;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.inventory.IInventory;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.IIcon;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;

import com.trekkiecub.allthethings.TileEntity_RockCrusher;

 

public class Block_Rock_Crusher extends BlockContainer {

public IIcon front_on, front_off, top, side;

protected static boolean changing = false;

 

 

protected Block_Rock_Crusher(Material p_i45394_1_, boolean working) {

super(p_i45394_1_);

this.changing = working;

}

 

@Override

public void registerBlockIcons(IIconRegister reg)

{

this.front_on = reg.registerIcon(this.textureName + "_front_on");

this.front_off = reg.registerIcon(this.textureName + "_front_off");

this.top = reg.registerIcon(this.textureName + "_top");

this.side = reg.registerIcon(this.textureName + "_side");

}

 

@Override

public IIcon getIcon(int dir, int meta)

{

if (meta > 5)

meta = 5;

 

if (dir == 4 && meta == 0)

{

return (this.lightValue > 0?this.front_on:this.front_off);

}

if (dir == 1)

return this.top;

if (meta == -1 || dir == meta)

{

return (this.lightValue > 0?this.front_on:this.front_off);

}

 

return this.side;

}

 

@Override

public void onBlockAdded(World world, int xcoord, int ycoord, int zcoord)

{

super.onBlockAdded(world, xcoord, ycoord, zcoord);

setRotatedMetadata(world, xcoord, ycoord, zcoord);

}

 

public void onBlockPlacedBy(World world, int xcoord, int ycoord, int zcoord, EntityLivingBase player, ItemStack theBlock)

{

int direction = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

switch (direction)

{

case 0:

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, 2, 2);

break;

case 1:

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, 5, 2);

break;

case 2:

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, 3, 2);

break;

case 3:

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, 4, 2);

break;

}

}

 

private void setRotatedMetadata(World world, int xcoord, int ycoord, int zcoord)

{

if (!world.isRemote)

{

Block north = world.getBlock(xcoord, ycoord, zcoord-1);

Block south = world.getBlock(xcoord, ycoord, zcoord+1);

Block east = world.getBlock(xcoord-1, ycoord, zcoord);

Block west = world.getBlock(xcoord+1, ycoord, zcoord);

byte newMeta = 3;

if (north.func_149730_j() && !south.func_149730_j())

{

newMeta = 3;

}

if (south.func_149730_j() && !north.func_149730_j())

{

newMeta = 2;

}

if (east.func_149730_j() && !west.func_149730_j())

{

newMeta = 5;

}

if (west.func_149730_j() && !east.func_149730_j())

{

newMeta = 4;

}

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, newMeta, 2);

}

}

 

@Override

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float a, float b, float c)

{

TileEntity tileEntity = world.getTileEntity(x, y, z);

if (tileEntity == null || player.isSneaking())

return false;

 

player.openGui("TrekkieCub_AllTheThings", 0, world, x, y, z);

return true;

}

@Override

public void breakBlock(World world, int x, int y, int z, Block block, int par6)

{

dropItems(world, x, y, z);

super.breakBlock(world, x, y, z, block, par6);

}

 

private void dropItems(World world, int x, int y, int z)

{

Random rand = new Random();

TileEntity tileEntity = world.getTileEntity(x, y, z);

 

if (!(tileEntity instanceof IInventory))

{

return;

}

IInventory inventory = (IInventory) tileEntity;

 

for (int i = 0; i < inventory.getSizeInventory(); i++)

{

ItemStack item = inventory.getStackInSlot(i);

 

if (item != null && item.stackSize > 0)

{

float randX = rand.nextFloat() * 0.8F + 0.1F;

float randY = rand.nextFloat() * 0.8F + 0.1F;

float randZ = rand.nextFloat() * 0.8F + 0.1F;

 

EntityItem entityItem = new EntityItem(world, x+randX, y+randY, z+randZ, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));

 

if (item.hasTagCompound())

{

entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());

}

 

float factor = 0.05F;

entityItem.motionX = rand.nextGaussian() * factor;

entityItem.motionY = rand.nextGaussian() * factor + 0.2F;

entityItem.motionZ = rand.nextGaussian() * factor;

world.spawnEntityInWorld(entityItem);

item.stackSize = 0;

}

}

}

 

@Override

public TileEntity createNewTileEntity(World var1, int var2) {

// TODO Auto-generated method stub

return new TileEntity_RockCrusher();

}

 

public static void updateCrusherStatus(boolean turnOn, World world, int x, int y, int z)

{

int meta = world.getBlockMetadata(x, y, z);

TileEntity tileEnt = world.getTileEntity(x, y, z);

 

world.removeTileEntity(x, y, z);

changing = true;

if (turnOn)

{

world.setBlock(x, y, z, mod_TCAllTheThings.dummy_Rock_Crusher);

}

else

{

world.setBlock(x, y, z, mod_TCAllTheThings.Rock_Crusher);

}

changing = false;

world.setBlockMetadataWithNotify(x, y, z, meta, 2);

if (tileEnt != null)

{

tileEnt.validate();

 

world.setTileEntity(x, y, z, tileEnt);

}

}

 

}

 

 

 

[spoiler=TileEntity_RockCrusher]

package com.trekkiecub.allthethings;

 

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;

import java.util.Random;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Items;

import net.minecraft.inventory.IInventory;

import net.minecraft.inventory.ISidedInventory;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.MathHelper;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class TileEntity_RockCrusher extends TileEntity implements IInventory, ISidedInventory {

private ItemStack[] itemStacks;

private int[] slots_top = new int[] {0};

private int[] slots_bottom = new int[] {1,2,3};

private int[] slots_side = new int[] {1,2,3};

 

private Map crushingList = new HashMap();

public int crushTime;

 

class crushEntry {

Item out_pri, out_sec, out_tert;

double numResources;

public crushEntry(Item out_pri, Item out_sec, Item out_tert, double numResources)

{

this.out_pri = out_pri;

this.out_sec = out_sec;

this.out_tert = out_tert;

this.numResources = numResources;

}

public void setResources(int num)

{

this.numResources = num;

}

}

 

public TileEntity_RockCrusher() {

itemStacks = new ItemStack[4];

 

crushingList.put(Items.diamond_axe, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 3));

crushingList.put(Items.diamond_boots, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 4));

crushingList.put(Items.diamond_chestplate, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 8));

crushingList.put(Items.diamond_helmet, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 5));

crushingList.put(Items.diamond_hoe, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 2));

crushingList.put(Items.diamond_horse_armor, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 6));

crushingList.put(Items.diamond_leggings, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 7));

crushingList.put(Items.diamond_pickaxe, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 3));

crushingList.put(Items.diamond_shovel, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 1));

crushingList.put(Items.diamond_sword, new crushEntry(Items.diamond, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 2));

 

crushingList.put(Items.diamond, new crushEntry(null, mod_TCAllTheThings.Shard_Diamond, mod_TCAllTheThings.Powdered_Diamond, 1));

 

crushingList.put(mod_TCAllTheThings.Shard_Diamond, new crushEntry(null, null, mod_TCAllTheThings.Powdered_Diamond, 0.25));

 

 

 

 

}

 

@Override

public int getSizeInventory() {

// TODO Auto-generated method stub

return itemStacks.length;

}

 

@Override

public ItemStack getStackInSlot(int var1) {

// TODO Auto-generated method stub

return itemStacks[var1];

}

 

@Override

public ItemStack decrStackSize(int slot, int amount) {

// TODO Auto-generated method stub

ItemStack stack = getStackInSlot(slot);

if (stack != null)

{

if (stack.stackSize <= amount)

{

setInventorySlotContents(slot, null);

}

else

{

stack = stack.splitStack(amount);

if (stack.stackSize == 0)

{

setInventorySlotContents(slot, null);

}

}

}

return stack;

}

 

@Override

public ItemStack getStackInSlotOnClosing(int slot) {

ItemStack stack = getStackInSlot(slot);

if (stack != null)

{

setInventorySlotContents(slot, null);

}

 

return stack;

}

 

@Override

public void setInventorySlotContents(int slot, ItemStack stack) {

itemStacks[slot] = stack;

if (stack != null && stack.stackSize > getInventoryStackLimit())

{

stack.stackSize = getInventoryStackLimit();

}

 

}

 

@Override

public String getInventoryName() {

// TODO Auto-generated method stub

return null;

}

 

@Override

public boolean hasCustomInventoryName() {

// TODO Auto-generated method stub

return false;

}

 

@Override

public int getInventoryStackLimit() {

// TODO Auto-generated method stub

return 64;

}

 

@Override

public boolean isUseableByPlayer(EntityPlayer player) {

// TODO Auto-generated method stub

return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this &&

player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;

}

 

@Override

public void openInventory() {

// TODO Auto-generated method stub

 

}

 

@Override

public void closeInventory() {

// TODO Auto-generated method stub

 

}

 

@Override

public boolean isItemValidForSlot(int slot, ItemStack stack) {

switch (slot)

{

case 0: //Input

{

 

if (crushingList.get(stack.getItem()) != null)

{

return true;

}

else

return false;

 

}

default:

return false;

}

}

 

/**

    * Returns an integer between 0 and the passed value representing how close the current item is to being completely

    * cooked

    */

    @SideOnly(Side.CLIENT)

    public int getCrushProgressScaled(int p_145953_1_)

    {

        return this.crushTime * p_145953_1_ / 200;

    }

   

    public boolean isWorking()

    {

    return this.crushTime > 0;

    }

 

   

    @Override

    public void updateEntity()

    {

   

    if (!this.worldObj.isRemote)

    {

    if (this.canProcess())

    {

    this.crushTime++;

   

    if (this.crushTime == 200)

    {

    this.crushTime = 0;

    this.processItem();

    Block_Rock_Crusher.updateCrusherStatus(false, this.worldObj, this.xCoord, this.yCoord, this.zCoord);

    }

    else if (this.crushTime == 1)

    {

   

    Block_Rock_Crusher.updateCrusherStatus(true, this.worldObj, this.xCoord, this.yCoord, this.zCoord);

    }

    }

    else

    this.crushTime = 0;

 

    }

    }

 

   

    private boolean canProcess()

    {

    if (this.itemStacks[0] == null)

    {

    return false;

    }

    else

    {

    // Get the crushEntry for the corresponding item in the input slot

    crushEntry resultEntry = (crushEntry) crushingList.get(this.itemStacks[0].getItem());

   

    // Return can't crush if the item doesn't have a recipe

    if (resultEntry == null) return false;

   

   

    // Create temporary new resource amounts

    int newResourceAmount = (int) (resultEntry.numResources * 4);

   

    if (this.itemStacks[0].getItem().getMaxDamage() != 0)

    {

    float percentDamaged = (float) this.itemStacks[0].getItemDamage() / this.itemStacks[0].getItem().getMaxDamage();

    newResourceAmount = MathHelper.floor_float((1 - percentDamaged) * newResourceAmount);

    }

 

   

   

    boolean firstPasses, secondPasses, thirdPasses;

   

    if (resultEntry.out_pri == null)

    {

    firstPasses = true;

    }

    else

    {

    if (this.itemStacks[1] == null || (this.itemStacks[1].getItem() == resultEntry.out_pri && this.itemStacks[1].stackSize + (newResourceAmount - newResourceAmount%4)/4 <= this.itemStacks[1].getMaxStackSize()))

    {

    firstPasses = true;

    }

    else

    return false;

    }

   

    if (this.itemStacks[2] == null || resultEntry.out_sec == null)

    {

    secondPasses = true;

    }

    else if (this.itemStacks[2].getItem() == resultEntry.out_sec && newResourceAmount + this.itemStacks[2].stackSize <= this.itemStacks[2].getMaxStackSize())

    {

    secondPasses = true;

    }

    else

    return false;

   

    if (this.itemStacks[3] == null || resultEntry.out_tert == null)

    {

    thirdPasses = true;

    }

    else if (this.itemStacks[3].getItem() == resultEntry.out_tert && newResourceAmount + this.itemStacks[3].stackSize <= this.itemStacks[3].getMaxStackSize())

    {

    thirdPasses = true;

    }

    else

    return false;

    return firstPasses && secondPasses && thirdPasses;

    }

    }

   

    public void processItem()

    {

    if (this.canProcess())

    {

    Random rand = new Random();

    // Get the crush entry for the corresponding item in the input slot

    crushEntry result = ((crushEntry) crushingList.get(this.itemStacks[0].getItem()));

   

    // Create temporary new resource amounts

    int newResourceAmount = (int) (result.numResources * 4);

   

    if (this.itemStacks[0].getItem().getMaxDamage() != 0)

    {

    float percentDamaged = (float) this.itemStacks[0].getItemDamage() / this.itemStacks[0].getItem().getMaxDamage();

    newResourceAmount = MathHelper.floor_float((1 - percentDamaged) * newResourceAmount);

    }

   

    boolean spawnedPrimary = false;

    int chance;

    for (int p = 0; p < newResourceAmount; p++)

    {

    spawnedPrimary = false;

    if (p%4 == 0 && result.out_pri != null)

    {

    chance = rand.nextInt(4);

    if (chance == 0)

    {

    if (this.itemStacks[1] == null)

    {

    this.itemStacks[1] = new ItemStack(result.out_pri, 1);

    }

    else

    {

    this.itemStacks[1].stackSize += 1;

    }

    p += 3; // This forces an increment of 4 instead of 1

    spawnedPrimary = true;

    }

   

    }

    if (!spawnedPrimary)

    {

    chance = rand.nextInt(4);

    if (chance == 0 && result.out_sec != null)

    {

    if (this.itemStacks[2] == null)

    {

    this.itemStacks[2] = new ItemStack(result.out_sec, 1);

    }

    else

    this.itemStacks[2].stackSize += 1;

    }

    else if (result.out_tert != null)

    {

    if (this.itemStacks[3] == null)

    {

    this.itemStacks[3] = new ItemStack(result.out_tert, 1);

    }

    else

    this.itemStacks[3].stackSize += 1;

    }

    }

    }

   

   

    this.itemStacks[0].stackSize--;

    if (this.itemStacks[0].stackSize <= 0)

    {

    this.itemStacks[0] = null;

    }

   

   

    }

    }

 

@Override

public int[] getAccessibleSlotsFromSide(int par1)

    {

        return par1 == 0 ? slots_bottom : (par1 == 1 ? slots_top : slots_side);

    }

 

@Override

public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3)

    {

        return this.isItemValidForSlot(par1, par2ItemStack);

    }

 

@Override

public boolean canExtractItem(int var1, ItemStack var2, int var3) {

if (var1 == 0 || var3 == 1)

{

return false;

}

return true;

}

 

}

 

 

 

[spoiler=Container_Rock_Crusher]

package com.trekkiecub.allthethings;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.inventory.Container;

import net.minecraft.inventory.ICrafting;

import net.minecraft.inventory.Slot;

import net.minecraft.inventory.SlotFurnace;

import net.minecraft.item.ItemStack;

 

public class Container_RockCrusher extends Container {

 

protected TileEntity_RockCrusher tileEntity;

int prevCrushTime = 0;

 

public Container_RockCrusher(InventoryPlayer inventoryPlayer, TileEntity_RockCrusher rcE)

{

tileEntity = rcE;

addSlotToContainer(new Slot(tileEntity, 0, 56, 35));

 

for (int i = 0; i < 3; i++)

{

addSlotToContainer(new SlotFurnace(inventoryPlayer.player, tileEntity, i+1, 116, 17 + i*18));

}

 

bindPlayerInventory(inventoryPlayer);

}

 

@Override

public void addCraftingToCrafters(ICrafting craftingThing)

{

super.addCraftingToCrafters(craftingThing);

craftingThing.sendProgressBarUpdate(this, 0, this.tileEntity.crushTime);

}

 

@Override

public void detectAndSendChanges()

{

super.detectAndSendChanges();

 

for (int i = 0; i < this.crafters.size(); ++i)

        {

            ICrafting icrafting = (ICrafting)this.crafters.get(i);

 

            if (this.prevCrushTime != this.tileEntity.crushTime)

            {

            icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.crushTime);

            }

        }

this.prevCrushTime = this.tileEntity.crushTime;

 

}

 

@SideOnly(Side.CLIENT)

    public void updateProgressBar(int par1, int par2)

    {

        this.tileEntity.crushTime = par2;

 

    }

 

@Override

public boolean canInteractWith(EntityPlayer var1) {

// TODO Auto-generated method stub

return tileEntity.isUseableByPlayer(var1);

}

 

protected void bindPlayerInventory(InventoryPlayer invPlayer)

{

for (int i = 0; i < 3; i++)

{

for (int j = 0; j < 9; j++)

{

addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));

}

}

for (int i = 0; i < 9; i++)

{

addSlotToContainer(new Slot(invPlayer, i, 8+i*18, 142));

}

}

 

@Override

public ItemStack transferStackInSlot(EntityPlayer player, int slot)

{

ItemStack stack = null;

Slot slotObject = (Slot) inventorySlots.get(slot);

 

if (slotObject != null && slotObject.getHasStack())

{

ItemStack stackInSlot = slotObject.getStack();

stack = stackInSlot.copy();

 

if (slot < 9)

{

if (!this.mergeItemStack(stackInSlot, 0, 35, true))

{

return null;

}

}

else if (!this.mergeItemStack(stackInSlot, 0, 9, false))

{

return null;

}

if (stackInSlot.stackSize == 0)

{

slotObject.putStack(null);

}

else

{

slotObject.onSlotChanged();

}

if (stackInSlot.stackSize == stack.stackSize)

{

return null;

}

slotObject.onPickupFromSlot(player, stackInSlot);

}

return stack;

}

 

}

 

 

 

[spoiler=Gui_RockCrusher]

package com.trekkiecub.allthethings;

 

import org.lwjgl.opengl.GL11;

 

import net.minecraft.client.gui.inventory.GuiContainer;

import net.minecraft.client.renderer.texture.TextureMap;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.util.IIcon;

import net.minecraft.util.ResourceLocation;

import net.minecraft.util.StatCollector;

import net.minecraftforge.fluids.FluidRegistry;

import net.minecraftforge.fluids.FluidStack;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

@SideOnly(Side.CLIENT)

public class Gui_RockCrusher extends GuiContainer {

 

private TileEntity_RockCrusher tileCrusher;

 

public Gui_RockCrusher(InventoryPlayer inventoryPlayer, TileEntity_RockCrusher tileRockCrusher) {

super(new Container_RockCrusher(inventoryPlayer, tileRockCrusher));

this.tileCrusher = tileRockCrusher;

}

 

@Override

protected void drawGuiContainerForegroundLayer(int param1, int param2)

{

fontRendererObj.drawString("Rock Crusher", 8, 6, 4210752);

 

fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize-96+2, 4210752);

 

 

}

 

@Override

protected void drawGuiContainerBackgroundLayer(float var1, int var2,

int var3) {

this.mc.renderEngine.bindTexture(new ResourceLocation("trekkiecub:textures/gui/rock_crusher.png"));

int x = (this.width - this.xSize)/2;

int y = (this.height - this.ySize)/2;

this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);

 

int i1 = this.tileCrusher.getCrushProgressScaled(24);

this.drawTexturedModalRect(x + 79, y + 34, 176, 14, i1 + 1, 16);

 

FluidStack afluid = new FluidStack(FluidRegistry.WATER, 1000);

mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);

GL11.glColor3f(1.0F, 1.0F, 1.0F);

this.drawTexturedModelRectFromIcon(x+5, y+20, afluid.getFluid().getIcon(afluid), 20, 20);

 

 

 

 

}

 

}

 

 

 

[spoiler=Block_Immersion_Tank]

package com.trekkiecub.allthethings;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.item.EntityItem;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.inventory.IInventory;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.IIcon;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;

import net.minecraftforge.fluids.FluidRegistry;

import net.minecraftforge.fluids.FluidStack;

 

public class Block_Immersion_Tank extends BlockContainer {

public IIcon front_trans, front_fluid, top, side;

 

protected Block_Immersion_Tank(Material p_i45386_1_) {

super(p_i45386_1_);

// TODO Auto-generated constructor stub

}

 

@Override

public void registerBlockIcons(IIconRegister reg)

{

this.front_trans = reg.registerIcon(this.textureName + "_front_transparent");

this.front_fluid = reg.registerIcon(this.textureName + "_front_default");

this.top = reg.registerIcon(this.textureName + "_top");

this.side = reg.registerIcon(this.textureName + "_side");

}

 

@Override public boolean renderAsNormalBlock()

{

return false;

}

 

@Override public int getRenderType()

{

return Proxy_Client.immersionTankRenderType;

}

 

@Override public boolean canRenderInPass(int pass)

{

Proxy_Client.renderPass = pass;

return true;

}

 

@Override public int getRenderBlockPass() {return 1;}

 

@Override

public IIcon getIcon(int dir, int meta)

{

if (meta > 5)

meta = 5;

 

if (dir == 4 && meta == 0)

{

//return (this.lightValue > 0?this.front_on:this.front_off);

return this.front_trans;

}

if (dir == 1)

return this.top;

if (meta == -1 || dir == meta)

{

//return (this.lightValue > 0?this.front_on:this.front_off);

return this.front_trans;

}

 

return this.side;

}

 

@Override

public void onBlockAdded(World world, int xcoord, int ycoord, int zcoord)

{

super.onBlockAdded(world, xcoord, ycoord, zcoord);

setRotatedMetadata(world, xcoord, ycoord, zcoord);

}

 

public void onBlockPlacedBy(World world, int xcoord, int ycoord, int zcoord, EntityLivingBase player, ItemStack theBlock)

{

int direction = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

switch (direction)

{

case 0:

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, 2, 2);

break;

case 1:

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, 5, 2);

break;

case 2:

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, 3, 2);

break;

case 3:

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, 4, 2);

break;

}

}

 

private void setRotatedMetadata(World world, int xcoord, int ycoord, int zcoord)

{

if (!world.isRemote)

{

Block north = world.getBlock(xcoord, ycoord, zcoord-1);

Block south = world.getBlock(xcoord, ycoord, zcoord+1);

Block east = world.getBlock(xcoord-1, ycoord, zcoord);

Block west = world.getBlock(xcoord+1, ycoord, zcoord);

byte newMeta = 3;

if (north.func_149730_j() && !south.func_149730_j())

{

newMeta = 3;

}

if (south.func_149730_j() && !north.func_149730_j())

{

newMeta = 2;

}

if (east.func_149730_j() && !west.func_149730_j())

{

newMeta = 5;

}

if (west.func_149730_j() && !east.func_149730_j())

{

newMeta = 4;

}

world.setBlockMetadataWithNotify(xcoord, ycoord, zcoord, newMeta, 2);

}

}

 

@Override

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float a, float b, float c)

{

TileEntity tileEntity = world.getTileEntity(x, y, z);

if (tileEntity == null || player.isSneaking())

return false;

 

player.openGui("TrekkieCub_AllTheThings", 1, world, x, y, z);

return true;

}

 

@Override

public void breakBlock(World world, int x, int y, int z, Block block, int par6)

{

dropItems(world, x, y, z);

super.breakBlock(world, x, y, z, block, par6);

}

 

private void dropItems(World world, int x, int y, int z)

{

Random rand = new Random();

TileEntity tileEntity = world.getTileEntity(x, y, z);

 

if (!(tileEntity instanceof IInventory))

{

return;

}

IInventory inventory = (IInventory) tileEntity;

 

for (int i = 0; i < inventory.getSizeInventory(); i++)

{

ItemStack item = inventory.getStackInSlot(i);

 

if (item != null && item.stackSize > 0)

{

float randX = rand.nextFloat() * 0.8F + 0.1F;

float randY = rand.nextFloat() * 0.8F + 0.1F;

float randZ = rand.nextFloat() * 0.8F + 0.1F;

 

EntityItem entityItem = new EntityItem(world, x+randX, y+randY, z+randZ, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));

 

if (item.hasTagCompound())

{

entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());

}

 

float factor = 0.05F;

entityItem.motionX = rand.nextGaussian() * factor;

entityItem.motionY = rand.nextGaussian() * factor + 0.2F;

entityItem.motionZ = rand.nextGaussian() * factor;

world.spawnEntityInWorld(entityItem);

item.stackSize = 0;

}

}

}

 

@Override

public TileEntity createNewTileEntity(World var1, int var2) {

// TODO Auto-generated method stub

return new TileEntity_ImmersionTank();

}

 

 

public static void updateTank(World world, int x, int y, int z)

{

TileEntity entity = world.getTileEntity(x, y, z);

int meta = world.getBlockMetadata(x, y, z);

world.removeTileEntity(x, y, z);

world.setBlock(x, y, z, mod_TCAllTheThings.Immersion_Tank);

world.setBlockMetadataWithNotify(x, y, z, meta, 2);

if (entity != null)

{

entity.validate();

world.setTileEntity(x, y, z, entity);

}

world.markBlockForUpdate(x, y, z);

}

 

 

 

}

 

 

 

[spoiler=TileEntity_ImmersionTank]

package com.trekkiecub.allthethings;

 

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;

import java.util.Random;

 

import com.trekkiecub.allthethings.TileEntity_RockCrusher.crushEntry;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.inventory.IInventory;

import net.minecraft.inventory.ISidedInventory;

import net.minecraft.item.ItemStack;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.MathHelper;

import net.minecraftforge.fluids.FluidRegistry;

import net.minecraftforge.fluids.FluidStack;

import net.minecraftforge.fluids.FluidTank;

 

public class TileEntity_ImmersionTank extends TileEntity implements IInventory, ISidedInventory {

private ItemStack[] itemStacks;

private FluidTank theFluid;

private ArrayList processingEntries = new ArrayList();

private ArrayList fillList = new ArrayList();

private ArrayList drainList = new ArrayList();

public int progress, soakTime;

public boolean fluidToggle = false;

 

class soakEntry {

ItemStack item_in;

FluidStack fluid_in;

ItemStack item_out;

FluidStack fluid_out;

int num_ticks;

public soakEntry (ItemStack item_in, ItemStack item_out, FluidStack fluid_in, FluidStack fluid_out, int num_ticks)

{

this.item_in = item_in;

this.item_out = item_out;

this.fluid_in = fluid_in;

this.fluid_out = fluid_out;

this.num_ticks = 200;

}

public soakEntry()

{

this.item_in = null;

this.item_out = null;

this.fluid_in = null;

this.fluid_out = null;

this.num_ticks = 200;

}

 

public ItemStack getItemInput() {return this.item_in;}

public ItemStack getItemOutput() {return this.item_out;}

public FluidStack getFluidInput() {return this.fluid_in;}

public FluidStack getFluidOutput() {return this.fluid_out;}

}

class fillEntry {

ItemStack item_input;

FluidStack fluid_input;

FluidStack fluid_output;

ItemStack item_output;

public fillEntry (ItemStack item_in, ItemStack item_out, FluidStack fluid_out)

{

this.item_input = item_in;

this.item_output = item_out;

this.fluid_input = null;

this.fluid_output = fluid_out;

}

}

class drainEntry {

ItemStack item_input;

FluidStack fluid_input;

FluidStack fluid_output;

ItemStack item_output;

public drainEntry (ItemStack item_in, ItemStack item_out, FluidStack fluid_in)

{

this.item_input = item_in;

this.item_output = item_out;

this.fluid_input = fluid_in;

this.fluid_output = null;

}

}

 

public TileEntity_ImmersionTank()

{

itemStacks = new ItemStack[3];

theFluid = new FluidTank(1000);

 

fillList.add(new fillEntry(new ItemStack(Items.water_bucket, 1), new ItemStack(Items.bucket, 1), new FluidStack(FluidRegistry.WATER, 1000)));

 

processingEntries.add(new soakEntry(new ItemStack(Blocks.cobblestone, 1), new ItemStack(Blocks.mossy_cobblestone, 1), new FluidStack(FluidRegistry.WATER, 1000), null, 200));

}

 

public FluidStack getFluid()

{

return this.theFluid.getFluid();

}

 

public void setFluid(FluidStack newFluid)

{

this.theFluid.setFluid(newFluid);

}

 

@Override public int[] getAccessibleSlotsFromSide(int var1) {

// TODO Auto-generated method stub

return null;

}

 

@Override public boolean canInsertItem(int var1, ItemStack var2, int var3) {

// TODO Auto-generated method stub

return false;

}

 

@Override public boolean canExtractItem(int var1, ItemStack var2, int var3) {

// TODO Auto-generated method stub

return false;

}

 

@Override public int getSizeInventory() {

return itemStacks.length;

}

 

@Override public ItemStack getStackInSlot(int var1) {

return itemStacks[var1];

}

 

@Override public ItemStack decrStackSize(int slot, int amount) {

ItemStack stack = getStackInSlot(slot);

if (stack != null)

{

if (stack.stackSize <= amount)

{

setInventorySlotContents(slot, null);

}

else

{

stack = stack.splitStack(amount);

if (stack.stackSize == 0)

{

setInventorySlotContents(slot, null);

}

}

}

return stack;

}

 

@Override public ItemStack getStackInSlotOnClosing(int slot) {

ItemStack stack = getStackInSlot(slot);

if (stack != null)

{

setInventorySlotContents(slot, null);

}

 

return stack;

}

 

@Override public void setInventorySlotContents(int slot, ItemStack stack) {

itemStacks[slot] = stack;

if (stack != null && stack.stackSize > getInventoryStackLimit())

{

stack.stackSize = getInventoryStackLimit();

}

 

}

 

@Override public String getInventoryName() {

// TODO Auto-generated method stub

return null;

}

 

@Override public boolean hasCustomInventoryName() {

// TODO Auto-generated method stub

return false;

}

 

@Override public int getInventoryStackLimit() { return 64; }

 

@Override public boolean isUseableByPlayer(EntityPlayer player) {

return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this &&

player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;

}

 

@Override public void openInventory() { }

 

@Override public void closeInventory() { }

 

@Override public boolean isItemValidForSlot(int slot, ItemStack stack) {

switch (slot)

{

case 0:

fillEntry fill = null;

// Get the crushEntry for the corresponding item in the input slot

    for (int p = 0; p < fillList.size() && fill == null; p++)

    {

    if (((fillEntry) fillList.get(p)).item_input == this.itemStacks[0])

    {

    fill = (fillEntry) fillList.get(p);

    }

    }

   

    // Return can't crush if the item doesn't have a recipe

    if (fill == null) return false;

    else return true;

case 1:

return true;

case 2:

drainEntry drain = null;

for (int p = 0; p < drainList.size() && drain == null; p++)

{

drainEntry currentEntry = (drainEntry) drainList.get(p);

if (currentEntry.item_input == this.itemStacks[2]  &&  currentEntry.fluid_input == this.theFluid.getFluid())

{

drain = currentEntry;

}

}

if (drain == null) return false;

else return true;

default:

return false;

}

}

 

    @SideOnly(Side.CLIENT)

    public int getSoakProgressScaled(int newMax)

    {

    if (this.soakTime == 0) {return 0;}

        return this.progress * newMax / soakTime;

    }

   

    @SideOnly(Side.CLIENT)

    public int getFluidAmountScaled(int newMax)

    {

    if (this.theFluid.getFluid() == null)

    return 0;

        return this.theFluid.getFluidAmount() * newMax / this.theFluid.getCapacity();

    }

   

    @Override public void updateEntity()

    {

    if (!this.worldObj.isRemote)

    {

    if (this.canProcess())

    {

    this.progress++;

   

    if (this.progress == soakTime)

    {

    this.progress = 0;

    this.soakTime = 1;

    this.processItem();

    }

    }

    else

    this.progress = 0;

    if (this.canFill())

    {

    fillTank();

    }

    if (this.canDrain())

    {

    drainTank();

    }

    this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);

 

    }

    }

 

    private boolean canFill()

    {

    if (this.itemStacks[0] == null || (this.theFluid.getFluid() != null && this.theFluid.getFluidAmount() != 0))

    {

    return false;

    }

    else

    {

    fillEntry fill = null;

    for (int p = 0; p < fillList.size() && fill == null; p++)

    {

    fillEntry currentEntry = (fillEntry) fillList.get(p);

    if (currentEntry.item_input == this.itemStacks[0])

    {

    fill = currentEntry;

    }

    }

    if (fill == null) return false;

    else return true;

    }

    }

   

    private boolean canDrain()

    {

    if (this.itemStacks[2] == null || this.theFluid.getFluid() == null || this.theFluid.getFluidAmount() == 0)

    {

    return false;

    }

    else

    {

    drainEntry drain = null;

    for (int p = 0; p < drainList.size() && drain == null; p++)

    {

    drainEntry currentEntry = (drainEntry) drainList.get(p);

    if (currentEntry.item_input == this.itemStacks[2] && currentEntry.fluid_input == this.theFluid.getFluid())

    {

    drain = currentEntry;

    }

    }

    if (drain == null) return false;

    else return true;

    }

    }

   

    private boolean canProcess()

    {

    if (this.itemStacks[1] == null)

    {

    return false;

    }

    else

    {

    // Get the crushEntry for the corresponding item in the input slot

    soakEntry resultEntry = null;

    for (int p = 0; p < processingEntries.size() && resultEntry == null; p++)

    {

    if (((soakEntry) processingEntries.get(p)).getItemInput() == this.itemStacks[1])

    {

    if (((soakEntry) processingEntries.get(p)).getFluidInput() == this.theFluid.getFluid())

    {

    resultEntry = (soakEntry) processingEntries.get(p);

    }

    }

    }

   

    // Return can't crush if the item doesn't have a recipe

    if (resultEntry == null) return false;

    else return true;

    }

    }

   

    public void fillTank()

    {

    if (this.canFill())

    {

    fillEntry fill = null;

    for (int p = 0; p < fillList.size() && fill == null; p++)

    {

    fillEntry currentEntry = (fillEntry) fillList.get(p);

    if (currentEntry.item_input == this.itemStacks[0])

    {

    fill = currentEntry;

    }

    }

    if (fill != null)

    {

    this.theFluid.setFluid(fill.fluid_output);

    this.itemStacks[0] = fill.item_output;

    }

    }

    }

   

    public void drainTank()

    {

    if (this.canDrain())

    {

    drainEntry drain = null;

    for (int p = 0; p < drainList.size() && drain == null; p++)

    {

    drainEntry currentEntry = (drainEntry) drainList.get(p);

    if (currentEntry.item_input == this.itemStacks[2] && currentEntry.fluid_input == this.theFluid.getFluid())

    {

    drain = currentEntry;

    }

    }

    if (drain != null)

    {

    this.theFluid.setFluid(null);

    this.itemStacks[0] = drain.item_output;

    }

    }

    }

   

    public void processItem()

    {

    if (this.canProcess())

    {

    // Get the correct soak entry for the inputs

    soakEntry resultEntry = null;

    for (int p = 0; p < processingEntries.size() && resultEntry == null; p++)

    {

    if (((soakEntry) processingEntries.get(p)).getItemInput() == this.itemStacks[1])

    {

    if (((soakEntry) processingEntries.get(p)).getFluidInput() == this.theFluid.getFluid())

    {

    resultEntry = (soakEntry) processingEntries.get(p);

    }

    }

    }

    if (resultEntry != null)

    {

    this.itemStacks[1] = resultEntry.getItemOutput();

    this.theFluid.setFluid(resultEntry.getFluidOutput());

    }

   

    }

    }

   

 

}

 

 

 

[spoiler=Container_ImmersionTank]

package com.trekkiecub.allthethings;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.inventory.Container;

import net.minecraft.inventory.ICrafting;

import net.minecraft.inventory.Slot;

import net.minecraft.item.ItemStack;

 

public class Container_ImmersionTank extends Container{

 

protected TileEntity_ImmersionTank tileEntity;

int prevProgress = 0;

 

public Container_ImmersionTank(InventoryPlayer invPlay, TileEntity_ImmersionTank tile)

{

this.tileEntity = tile;

addSlotToContainer(new Slot(tileEntity, 0, 16, 37));

addSlotToContainer(new Slot(tileEntity, 1, 80, 37));

addSlotToContainer(new Slot(tileEntity, 2, 145, 37));

 

bindPlayerInventory(invPlay);

}

 

protected void bindPlayerInventory(InventoryPlayer invPlayer)

{

for (int i = 0; i < 3; i++)

{

for (int j = 0; j < 9; j++)

{

addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));

}

}

for (int i = 0; i < 9; i++)

{

addSlotToContainer(new Slot(invPlayer, i, 8+i*18, 142));

}

}

 

@Override public void addCraftingToCrafters(ICrafting craftingThing)

{

super.addCraftingToCrafters(craftingThing);

craftingThing.sendProgressBarUpdate(this, 0, this.tileEntity.progress);

}

 

@Override public void detectAndSendChanges()

{

super.detectAndSendChanges();

 

for (int i = 0; i < this.crafters.size(); ++i)

        {

            ICrafting icrafting = (ICrafting)this.crafters.get(i);

 

            if (this.prevProgress != this.tileEntity.progress)

            {

            icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);

            }

        }

this.prevProgress = this.tileEntity.progress;

 

}

 

@SideOnly(Side.CLIENT)

public void updateProgressBar(int par1, int par2)

    {

        this.tileEntity.progress = par2;

 

    }

 

@Override public boolean canInteractWith(EntityPlayer var1) {

// TODO Auto-generated method stub

return tileEntity.isUseableByPlayer(var1);

}

 

@Override public ItemStack transferStackInSlot(EntityPlayer player, int slot)

{

ItemStack stack = null;

Slot slotObject = (Slot) inventorySlots.get(slot);

 

if (slotObject != null && slotObject.getHasStack())

{

ItemStack stackInSlot = slotObject.getStack();

stack = stackInSlot.copy();

if (slot < 3)

{

if (!this.mergeItemStack(stackInSlot, 0, 35, true))

{

return null;

}

}

else if (!this.mergeItemStack(stackInSlot, 0, 9, false))

{

return null;

}

if (stackInSlot.stackSize == 0)

{

slotObject.putStack(null);

}

else

slotObject.onSlotChanged();

if (stackInSlot.stackSize == stack.stackSize)

{

return null;

}

slotObject.onPickupFromSlot(player, stackInSlot);

}

return stack;

}

 

 

 

}

 

 

 

[spoiler=Gui_ImmersionTank]

package com.trekkiecub.allthethings;

 

import net.minecraft.client.gui.inventory.GuiContainer;

import net.minecraft.client.renderer.texture.TextureMap;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.util.IIcon;

import net.minecraft.util.ResourceLocation;

import net.minecraft.util.StatCollector;

import net.minecraftforge.fluids.FluidRegistry;

import net.minecraftforge.fluids.FluidStack;

 

import org.lwjgl.opengl.GL11;

 

public class Gui_ImmersionTank extends GuiContainer {

private TileEntity_ImmersionTank tileTank;

 

public Gui_ImmersionTank(InventoryPlayer invPlayer, TileEntity_ImmersionTank tileImmTank)

{

super(new Container_ImmersionTank(invPlayer, tileImmTank));

this.tileTank = tileImmTank;

}

 

@Override protected void drawGuiContainerForegroundLayer(int param1, int param2)

{

fontRendererObj.drawString("Immersion Tank", 8, 6, 4210752);

fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize-96+2, 4210752);

}

 

@Override

protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {

this.mc.renderEngine.bindTexture(new ResourceLocation("trekkiecub:textures/gui/immersion_tank.png"));

int x = (this.width - this.xSize)/2;

int y = (this.height - this.ySize)/2;

this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);

 

// Soak Progress Bar

 

int startPoint = this.tileTank.getSoakProgressScaled(54);

this.drawTexturedModalRect(x+62, x+69, 2, 176, startPoint+1, 5);

 

// Fluid

 

FluidStack fluid = tileTank.getFluid();

IIcon drawThis;

if (fluid == null)

{

drawThis = FluidRegistry.WATER.getStillIcon();

}

else

drawThis = fluid.getFluid().getStillIcon();

mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);

GL11.glColor3f(1.0F,1.0F,1.0F);

int rectHeight = this.tileTank.getFluidAmountScaled(37);

this.drawTexturedModelRectFromIcon(x+65, y+27+(37-rectHeight), drawThis, 48, rectHeight); // max 63

 

this.mc.renderEngine.bindTexture(new ResourceLocation("trekkiecub:textures/gui/immersion_tank.png"));

GL11.glColor3f(1.0F, 1.0F, 1.0F);

this.drawTexturedModalRect(x+79, y+36, 79, 36, 18, 18);

 

}

 

}

 

 

 

[spoiler=Render_Immersion_Tank]

package com.trekkiecub.allthethings;

 

import net.minecraft.block.Block;

import net.minecraft.client.renderer.RenderBlocks;

import net.minecraft.init.Blocks;

import net.minecraft.util.IIcon;

import net.minecraft.util.MathHelper;

import net.minecraft.world.IBlockAccess;

import net.minecraft.world.World;

import net.minecraftforge.fluids.FluidRegistry;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;

import com.trekkiecub.allthethings.Block_Immersion_Tank;

 

public class Render_Immersion_Tank implements ISimpleBlockRenderingHandler {

 

 

@Override

public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {

// TODO Auto-generated method stub

 

}

 

@Override

public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {

if (Proxy_Client.renderPass == 0)

{

IIcon newIcon;

TileEntity_ImmersionTank tileEnt = (TileEntity_ImmersionTank) world.getTileEntity(x, y, z);

 

 

if (tileEnt.getFluid() == null || tileEnt.getFluid().amount == 0)

{

newIcon = ((Block_Immersion_Tank) block).front_fluid;

}

else

newIcon = tileEnt.getFluid().getFluid().getStillIcon();

 

renderer.renderFaceXNeg(block, x, y, z, newIcon);

renderer.renderFaceXPos(block, x, y, z, newIcon);

renderer.renderFaceZNeg(block, x, y, z, newIcon);

renderer.renderFaceZPos(block, x, y, z, newIcon);

renderer.renderFaceYNeg(block, x, y, z, newIcon);

renderer.renderFaceYPos(block, x, y, z, newIcon);

//renderer.renderStandardBlock(Blocks.flowing_water, x, y, z);

}

else

{

renderer.renderStandardBlock(mod_TCAllTheThings.Immersion_Tank, x, y, z);

}

 

return true;

}

 

 

 

@Override

public boolean shouldRender3DInInventory(int modelId) {

// TODO Auto-generated method stub

return false;

}

 

@Override

public int getRenderId() {

return Proxy_Client.immersionTankRenderType;

}

 

}

 

 

 

[spoiler=GuiHandler]

package com.trekkiecub.allthethings;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

import cpw.mods.fml.common.network.IGuiHandler;

 

public class GuiHandler implements IGuiHandler{

 

@Override

public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

TileEntity tileEntity = world.getTileEntity(x, y, z);

switch (ID)

{

case 0:

return (tileEntity instanceof TileEntity_RockCrusher ? new Container_RockCrusher(player.inventory, (TileEntity_RockCrusher) tileEntity) : null);

case 1:

return (tileEntity instanceof TileEntity_ImmersionTank ? new Container_ImmersionTank(player.inventory, (TileEntity_ImmersionTank) tileEntity) : null);

default:

return null;

}

}

 

@Override

public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

 

TileEntity tileEntity = world.getTileEntity(x, y, z);

switch (ID)

{

case 0:

return (tileEntity instanceof TileEntity_RockCrusher ? new Gui_RockCrusher(player.inventory, (TileEntity_RockCrusher) tileEntity) : null);

case 1:

return (tileEntity instanceof TileEntity_ImmersionTank ? new Gui_ImmersionTank(player.inventory, (TileEntity_ImmersionTank) tileEntity) : null);

}

return null;

}

 

}

 

 

 

[spoiler=Proxy_Client]

package com.trekkiecub.allthethings;

 

import cpw.mods.fml.client.registry.RenderingRegistry;

 

public class Proxy_Client extends Proxy_Common {

public static int renderPass;

public static int immersionTankRenderType;

@Override

public void registerRenderThings()

{

immersionTankRenderType = RenderingRegistry.getNextAvailableRenderId();

RenderingRegistry.registerEntityRenderingHandler(Entity_Mummy.class, new Render_Mummy(new Model_Mummy(), 0.5f));

RenderingRegistry.registerBlockHandler(new Render_Immersion_Tank());

}

}

 

 

 

[spoiler=Proxy_Common]

package com.trekkiecub.allthethings;

 

public class Proxy_Common {

public void registerRenderThings() { }

}

 

 

 

[spoiler=Main mod file]

package com.trekkiecub.allthethings;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.EntityList;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.biome.BiomeGenBase;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.registry.EntityRegistry;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.network.NetworkRegistry;

 

 

@Mod(modid="TrekkieCub_AllTheThings", name = "Trekkie Cub's All The Things", version = "alpha")

 

public class mod_TCAllTheThings {

 

//

//  Create an instance of the mod

//

 

@Instance("mod_TCAllTheThings")

public static mod_TCAllTheThings instance;

 

//

//  Creative Mode Tab

//

 

public static CreativeTabs allTheThingsTab = new CreativeTabs("allTheThings"){

@Override

public Item getTabIconItem() {

return Items.emerald;

}

};

 

//

//  Item Declarations

//

 

public static Item Paper_Bowl, Shard_Diamond, Shard_Stone, Powdered_Diamond, Powdered_Stone, Fried_Egg, Burial_Wraps;

 

//

//  Block Declarations

//

 

public static Block Rock_Crusher, dummy_Rock_Crusher, Immersion_Tank;

 

//

//  Proxy Definitions

//

 

@SidedProxy(clientSide = "com.trekkiecub.allthethings.Proxy_Client", serverSide = "com.trekkiecub.allthethings.Proxy_Common")

public static Proxy_Common commonProxy;

public static Proxy_Client clientProxy;

 

//

//  Pre-Initialization Event

//

 

@EventHandler

public void preInit(FMLPreInitializationEvent e) {

clientProxy = new Proxy_Client();

//

//  Constants

//

 

int ID_Mummy = EntityRegistry.findGlobalUniqueEntityId();

 

//

//  Item Definitions

//

 

Paper_Bowl = new Item_Paper_Bowl().setCreativeTab(allTheThingsTab).setUnlocalizedName("paper_bowl").setTextureName("trekkiecub:paper_bowl");

Shard_Diamond = new Item_Shard_Diamond();

Shard_Stone = new Item_Shard_Stone().setCreativeTab(allTheThingsTab).setUnlocalizedName("shard_stone").setTextureName("trekkiecub:shard_rock");

Powdered_Diamond = new Item_Powdered_Diamond().setCreativeTab(allTheThingsTab).setUnlocalizedName("powdered_diamond").setTextureName("trekkiecub:powdered_diamond");

Powdered_Stone = new Item_Powdered_Stone().setCreativeTab(allTheThingsTab).setUnlocalizedName("powdered_stone").setTextureName("trekkiecub:powdered_stone");

Fried_Egg = new Item_Fried_Egg(6, 0.6F).setCreativeTab(allTheThingsTab).setUnlocalizedName("fried_egg").setTextureName("trekkiecub:fried_egg");

Burial_Wraps = new Item_Burial_Wraps().setCreativeTab(allTheThingsTab).setUnlocalizedName("burial_wraps").setTextureName("trekkiecub:burial_wraps");

 

//

//  Item Registry

//

 

GameRegistry.registerItem(Paper_Bowl, "paper_bowl");

GameRegistry.registerItem(Shard_Diamond, "shard_diamond");

GameRegistry.registerItem(Powdered_Diamond, "powdered_diamond");

GameRegistry.registerItem(Powdered_Stone, "powdered_stone");

GameRegistry.registerItem(Shard_Stone, "shard_stone");

GameRegistry.registerItem(Fried_Egg, "fried_egg");

GameRegistry.registerItem(Burial_Wraps, "burial_wraps");

 

//

//  Block Definitions

//

 

Rock_Crusher = new Block_Rock_Crusher(Material.rock, false).setStepSound(Block.soundTypeStone).setBlockName("block_rock_crusher").setCreativeTab(allTheThingsTab).setBlockTextureName("trekkiecub:rock_crusher");

dummy_Rock_Crusher = new Block_Rock_Crusher(Material.rock, true).setStepSound(Block.soundTypeStone).setBlockName("block_rock_crusher").setBlockTextureName("trekkiecub:rock_crusher").setLightLevel((float)1/15);

Immersion_Tank = new Block_Immersion_Tank(Material.rock).setStepSound(Block.soundTypeStone).setBlockName("block_immersion_tank").setCreativeTab(allTheThingsTab).setBlockTextureName("trekkiecub:immersion_tank");

 

//

//  Block Registry

//

 

GameRegistry.registerBlock(Rock_Crusher, "block_rock_crusher");

GameRegistry.registerBlock(dummy_Rock_Crusher, "lit_block_rock_crusher");

GameRegistry.registerBlock(Immersion_Tank, "block_immersion_tank");

 

//

// Entity Registry

//

 

EntityRegistry.registerGlobalEntityID(Entity_Mummy.class, "Mummy", ID_Mummy);

EntityRegistry.registerModEntity(Entity_Mummy.class, "Mummy", ID_Mummy, this, 80, 1, true);

EntityRegistry.addSpawn(Entity_Mummy.class, 2, 0, 1, EnumCreatureType.monster, BiomeGenBase.desert);

EntityList.entityEggs.put(Integer.valueOf(ID_Mummy), new EntityList.EntityEggInfo(ID_Mummy, 0xe9e5c3, 0xc6c57b));

 

 

//

//  Crafting Recipes

//

 

GameRegistry.addRecipe(new ItemStack(Paper_Bowl, 10), "p p", " p ", 'p', Items.paper);

GameRegistry.addRecipe(new ItemStack(Rock_Crusher), "cpc", "p p", "cpc", 'c', Blocks.cobblestone, 'p', Blocks.piston);

GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 50), "ggg", "geg", "ggg", 'g', Items.gunpowder, 'e', Items.egg);

GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, ID_Mummy), "www", "wew", "www", 'w', Burial_Wraps, 'e', Items.egg);

GameRegistry.addRecipe(new ItemStack(Immersion_Tank), "i i", "ici", "iii", 'i', Items.iron_ingot, 'c', Blocks.chest);

GameRegistry.addShapelessRecipe(new ItemStack(Immersion_Tank), new ItemStack(Blocks.cauldron), new ItemStack(Blocks.chest));

 

//

//  Smelting Recipes

//

 

GameRegistry.addSmelting(Items.egg, new ItemStack(Fried_Egg), 0);

 

//

//  Proxy Functions

//

 

clientProxy.registerRenderThings();

}

 

//

//  Initialization Event

//

 

@EventHandler

public void Init(FMLInitializationEvent e) {

 

}

 

//

//  Post-Initialization Event

//

 

@EventHandler

public void postInit(FMLPostInitializationEvent e) {

//

//  Network Registry

//

 

NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

}

 

}

 

 

 

Link to comment
Share on other sites

Well, I looked through your code. the only relevant references to world.isRemote was in your setRotatedMetadata methods. said methods are only called from onBlockAdded. onBlockAdded is only called on serverside, so in your relevant situation, world.isRemote should ALWAYS be false. are you sure you are getting otherwise? if so, then something is very wrong.

If I ever say something stupid, or simply incorrect, please excuse me. I don't know anything about 1.8 modding, and I don't know much about entities either, But I try to help when I can.

Link to comment
Share on other sites

As I said, the problem seems to be in TileEntity_ImmersionTank's updateEntity function.  I had a set of statements which would toggle the fluid in the Immersion Tank between water and lava every time the updateEntity function was called, and these statements worked when they were put at the beginning of the updateEntity function, before any other code.  Once they were put in the if (!world.isRemote) block, they stopped working.  So I'm fairly certain that I'm getting true at that point.

Link to comment
Share on other sites

I think the change made your TileEntity have the appearance of not working, since unless you have a packet handler notifying the client of changes, the client is going to be unaware of any of the changes made to the TileEntity serverside.

 

Effectively, your updateEntity logic doesn't happen on the client, and unless you have a packet handler to let the client know about these state changes, it will look (from the client perspective) like it isn't working anymore.

Link to comment
Share on other sites

I've been trying to implement some kind of packet handling in case this is the issue but I can't find a decent packet handling tutorial anywhere.  I keep finding outdated and contradictory information and I don't know which directions to follow and which ones not to for my particular Minecraft and Forge versions.

 

I have Minecraft 1.7.2, Forge 10.12.1.1060, FML 7.2.156.1060, MCP 9.01-pre

Link to comment
Share on other sites

TileEntities already have packet communication built into them.

 

	@Override
public Packet getDescriptionPacket() {
	NBTTagCompound nbtTag = new NBTTagCompound();
	writeToNBT(nbtTag);
	return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbtTag);
}

@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
	readFromNBT(packet.func_148857_g());
}

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

And why would you NOT save those variables to NBT?  Do you want them to get reset when you save and exit?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

And why would you NOT save those variables to NBT?  Do you want them to get reset when you save and exit?

Yes, they absolutely should be written to NBT - I'm only commenting on Trekkie's onUpdate method as it currently exists in the top post. (Did you look at it?) I had no way of knowing whether the mod had some kind of external custom packet handler for synching these values not shown in the original post, hence my wording.

 

To recap, for Trekkie's benefit:

- Only side-local fields are being modified

- The TE's NBT isn't being notified of this, (hence the builtin handling Draco mentioned isn't being used)

- There is no custom packet handling synching the values, hence the block has the appearance of "not working" client side

- Therefore you need some kind of packet handling to notify each side of changes.

Link to comment
Share on other sites

You will have to implement the read/write to/from NBT methods as well.  NBT isn't hard, just take the nbt and use the getInt or setInt functions (or other types as needed).  You can save any primitive type inside NBT, as well as other NBT tags.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

What about more complex data types, like ItemStacks and FluidStacks?  I seem to be having trouble with those.

 

This is the code I have for my NBT functions so far:

[spoiler=NBT Functions]

    public void readFromNBT(NBTTagCompound tag)

    {

        super.readFromNBT(tag);

        itemStacks[0].readFromNBT(tag.getCompoundTag("slot0Stack"));

        itemStacks[1].readFromNBT(tag.getCompoundTag("slot1Stack"));

        itemStacks[2].readFromNBT(tag.getCompoundTag("slot2Stack"));

        theFluid.readFromNBT(tag.getCompoundTag("fluidStack"));

        progress = tag.getInteger("progress");

    }

 

    public void writeToNBT(NBTTagCompound tag)

    {

    super.writeToNBT(tag);

    tag.setTag("slot0Stack", itemStacks[0].stackTagCompound);

    tag.setTag("slot1Stack", itemStacks[1].stackTagCompound);

    tag.setTag("slot2Stack", itemStacks[2].stackTagCompound);

    tag.setTag("fluidStack", theFluid.getFluid().tag);

    tag.setLong("progress", progress);

    }

 

 

 

Am I doing this completely wrong?

 

Edit: I was having a null pointer exception, but I think I figured it out.

 

Now that I've got the NBT and packet functions added, do I need to call any of them manually?  It seems my updateEntity() function is still not working, so some of the functions aren't being called automatically.

 

 

Link to comment
Share on other sites

ItemStack has a writeToNBT method, which returns NBT, which is savable into NBT.

 

Here's how it's usually done.

 

@Override
    public void readFromNBT(NBTTagCompound tc) {
        super.readFromNBT(tc);
        NBTTagList nbttaglist = tc.getTagList("Items", 10);
        inventory = new ItemStack[getSizeInventory()];

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
            int j = nbttagcompound1.getByte("Slot") & 255;

            if (j >= 0 && j < inventory.length)
            {
                inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
            }
        }
    }

    @Override
    public void writeToNBT(NBTTagCompound tc) {
        super.writeToNBT(tc);
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 0; i < inventory.length; ++i)
        {
            if (inventory[i] != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setByte("Slot", (byte)i);
                inventory[i].writeToNBT(nbttagcompound1);
                nbttaglist.appendTag(nbttagcompound1);
            }
        }
    }

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Are there any functions I have to call manually in my code when things need to get saved and updated?

 

Call manually?  No.*

Implement?  Yes.

 

*Note: There are some functions that are helpful to call manually in certain circumstances, but not technically required.

 

Whenever your TE's data changes (item is added/removed, etc.)

 

if (worldObj != null) {
    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); //tells the server that the client needs an update
}
markDirty(); //tells the server that a change that will require saving has occurred.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

This is the TileEntity file I have now.  Right now items are not being kept between exiting the world and going back in.  This is the only file that has changed other than registering the tile entity with the main mod file.

 

[spoiler=TileEntity]

package com.trekkiecub.allthethings;

 

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;

import java.util.Random;

 

import com.trekkiecub.allthethings.TileEntity_RockCrusher.crushEntry;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.inventory.IInventory;

import net.minecraft.inventory.ISidedInventory;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.nbt.NBTTagList;

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.minecraftforge.fluids.FluidRegistry;

import net.minecraftforge.fluids.FluidStack;

import net.minecraftforge.fluids.FluidTank;

 

public class TileEntity_ImmersionTank extends TileEntity implements IInventory, ISidedInventory {

private ItemStack[] itemStacks;

private FluidTank theFluid;

private ArrayList processingEntries = new ArrayList();

private ArrayList fillList = new ArrayList();

private ArrayList drainList = new ArrayList();

public int progress, soakTime;

 

class soakEntry {

ItemStack item_in;

FluidStack fluid_in;

ItemStack item_out;

FluidStack fluid_out;

int num_ticks;

public soakEntry (ItemStack item_in, ItemStack item_out, FluidStack fluid_in, FluidStack fluid_out, int num_ticks)

{

this.item_in = item_in;

this.item_out = item_out;

this.fluid_in = fluid_in;

this.fluid_out = fluid_out;

this.num_ticks = 200;

}

public soakEntry()

{

this.item_in = null;

this.item_out = null;

this.fluid_in = null;

this.fluid_out = null;

this.num_ticks = 200;

}

 

public ItemStack getItemInput() {return this.item_in;}

public ItemStack getItemOutput() {return this.item_out;}

public FluidStack getFluidInput() {return this.fluid_in;}

public FluidStack getFluidOutput() {return this.fluid_out;}

}

class fillEntry {

ItemStack item_input;

FluidStack fluid_input;

FluidStack fluid_output;

ItemStack item_output;

public fillEntry (ItemStack item_in, ItemStack item_out, FluidStack fluid_out)

{

this.item_input = item_in;

this.item_output = item_out;

this.fluid_input = null;

this.fluid_output = fluid_out;

}

}

class drainEntry {

ItemStack item_input;

FluidStack fluid_input;

FluidStack fluid_output;

ItemStack item_output;

public drainEntry (ItemStack item_in, ItemStack item_out, FluidStack fluid_in)

{

this.item_input = item_in;

this.item_output = item_out;

this.fluid_input = fluid_in;

this.fluid_output = null;

}

}

 

public TileEntity_ImmersionTank()

{

itemStacks = new ItemStack[3];

theFluid = new FluidTank(1000);

theFluid.setFluid(new FluidStack(FluidRegistry.WATER, 1000));

itemStacks[1] = new ItemStack(Blocks.cobblestone, 1);

 

if (worldObj != null)

{

worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);

}

markDirty();

 

fillList.add(new fillEntry(new ItemStack(Items.water_bucket, 1), new ItemStack(Items.bucket, 1), new FluidStack(FluidRegistry.WATER, 1000)));

 

processingEntries.add(new soakEntry(new ItemStack(Blocks.cobblestone, 1), new ItemStack(Blocks.mossy_cobblestone, 1), new FluidStack(FluidRegistry.WATER, 1000), null, 200));

}

 

public FluidStack getFluid()

{

return this.theFluid.getFluid();

}

 

public void setFluid(FluidStack newFluid)

{

this.theFluid.setFluid(newFluid);

}

 

@Override public int[] getAccessibleSlotsFromSide(int var1) {

// TODO Auto-generated method stub

return null;

}

 

@Override public boolean canInsertItem(int var1, ItemStack var2, int var3) {

// TODO Auto-generated method stub

return false;

}

 

@Override public boolean canExtractItem(int var1, ItemStack var2, int var3) {

// TODO Auto-generated method stub

return false;

}

 

@Override public int getSizeInventory() {

return itemStacks.length;

}

 

@Override public ItemStack getStackInSlot(int var1) {

return itemStacks[var1];

}

 

@Override public ItemStack decrStackSize(int slot, int amount) {

ItemStack stack = getStackInSlot(slot);

if (stack != null)

{

if (stack.stackSize <= amount)

{

setInventorySlotContents(slot, null);

}

else

{

stack = stack.splitStack(amount);

if (stack.stackSize == 0)

{

setInventorySlotContents(slot, null);

}

}

}

return stack;

}

 

@Override public ItemStack getStackInSlotOnClosing(int slot) {

ItemStack stack = getStackInSlot(slot);

if (stack != null)

{

setInventorySlotContents(slot, null);

}

 

return stack;

}

 

@Override public void setInventorySlotContents(int slot, ItemStack stack) {

itemStacks[slot] = stack;

if (stack != null && stack.stackSize > getInventoryStackLimit())

{

stack.stackSize = getInventoryStackLimit();

}

 

}

 

@Override public String getInventoryName() {

// TODO Auto-generated method stub

return null;

}

 

@Override public boolean hasCustomInventoryName() {

// TODO Auto-generated method stub

return false;

}

 

@Override public int getInventoryStackLimit() { return 64; }

 

@Override public boolean isUseableByPlayer(EntityPlayer player) {

return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this &&

player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;

}

 

@Override public void openInventory() { }

 

@Override public void closeInventory() { }

 

@Override public boolean isItemValidForSlot(int slot, ItemStack stack) {

switch (slot)

{

case 0:

fillEntry fill = null;

// Get the crushEntry for the corresponding item in the input slot

    for (int p = 0; p < fillList.size() && fill == null; p++)

    {

    if (((fillEntry) fillList.get(p)).item_input == this.itemStacks[0])

    {

    fill = (fillEntry) fillList.get(p);

    }

    }

   

    // Return can't crush if the item doesn't have a recipe

    if (fill == null) return false;

    else return true;

case 1:

return true;

case 2:

drainEntry drain = null;

for (int p = 0; p < drainList.size() && drain == null; p++)

{

drainEntry currentEntry = (drainEntry) drainList.get(p);

if (currentEntry.item_input == this.itemStacks[2]  &&  currentEntry.fluid_input == this.theFluid.getFluid())

{

drain = currentEntry;

}

}

if (drain == null) return false;

else return true;

default:

return false;

}

}

 

    @SideOnly(Side.CLIENT)

    public int getSoakProgressScaled(int newMax)

    {

    if (this.soakTime == 0) {return 0;}

        return this.progress * newMax / soakTime;

    }

   

    @SideOnly(Side.CLIENT)

    public int getFluidAmountScaled(int newMax)

    {

    if (this.theFluid.getFluid() == null)

    return 0;

        return this.theFluid.getFluidAmount() * newMax / this.theFluid.getCapacity();

    }

   

   

    @Override public void updateEntity()

    {

   

    if (!this.worldObj.isRemote)

    {

   

    if (this.canProcess())

    {

    this.progress++;

   

    if (this.progress == soakTime)

    {

    this.progress = 0;

    this.soakTime = 1;

    this.processItem();

        if (worldObj != null)

        {

        worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);

        }

        markDirty();

    }

   

    }

    else if (this.progress != 0)

    {

    this.progress = 0;

    if (worldObj != null)

    {

    worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);

    }

    markDirty();

    }

    if (this.canFill())

    {

    fillTank();

    if (worldObj != null)

    {

    worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);

    }

    markDirty();

    }

    if (this.canDrain())

    {

    drainTank();

    if (worldObj != null)

    {

    worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);

    }

    markDirty();

    }

   

    }

    }

 

    private boolean canFill()

    {

    if (this.itemStacks[0] == null || (this.theFluid.getFluid() != null && this.theFluid.getFluidAmount() != 0))

    {

    return false;

    }

    else

    {

    fillEntry fill = null;

    for (int p = 0; p < fillList.size() && fill == null; p++)

    {

    fillEntry currentEntry = (fillEntry) fillList.get(p);

    if (currentEntry.item_input == this.itemStacks[0])

    {

    fill = currentEntry;

    }

    }

    if (fill == null) return false;

    else return true;

    }

    }

   

    private boolean canDrain()

    {

    if (this.itemStacks[2] == null || this.theFluid.getFluid() == null || this.theFluid.getFluidAmount() == 0)

    {

    return false;

    }

    else

    {

    drainEntry drain = null;

    for (int p = 0; p < drainList.size() && drain == null; p++)

    {

    drainEntry currentEntry = (drainEntry) drainList.get(p);

    if (currentEntry.item_input == this.itemStacks[2] && currentEntry.fluid_input == this.theFluid.getFluid())

    {

    drain = currentEntry;

    }

    }

    if (drain == null) return false;

    else return true;

    }

    }

   

    private boolean canProcess()

    {

    if (this.itemStacks[1] == null)

    {

    return false;

    }

    else

    {

    // Get the crushEntry for the corresponding item in the input slot

    soakEntry resultEntry = null;

    for (int p = 0; p < processingEntries.size() && resultEntry == null; p++)

    {

    if (((soakEntry) processingEntries.get(p)).getItemInput() == this.itemStacks[1])

    {

    if (((soakEntry) processingEntries.get(p)).getFluidInput() == this.theFluid.getFluid())

    {

    resultEntry = (soakEntry) processingEntries.get(p);

    }

    }

    }

   

    // Return can't crush if the item doesn't have a recipe

    if (resultEntry == null) return false;

    else return true;

    }

    }

   

    public void fillTank()

    {

    if (this.canFill())

    {

    fillEntry fill = null;

    for (int p = 0; p < fillList.size() && fill == null; p++)

    {

    fillEntry currentEntry = (fillEntry) fillList.get(p);

    if (currentEntry.item_input == this.itemStacks[0])

    {

    fill = currentEntry;

    }

    }

    if (fill != null)

    {

    this.theFluid.setFluid(fill.fluid_output);

    this.itemStacks[0] = fill.item_output;

    }

    }

    }

   

    public void drainTank()

    {

    if (this.canDrain())

    {

    drainEntry drain = null;

    for (int p = 0; p < drainList.size() && drain == null; p++)

    {

    drainEntry currentEntry = (drainEntry) drainList.get(p);

    if (currentEntry.item_input == this.itemStacks[2] && currentEntry.fluid_input == this.theFluid.getFluid())

    {

    drain = currentEntry;

    }

    }

    if (drain != null)

    {

    this.theFluid.setFluid(null);

    this.itemStacks[0] = drain.item_output;

    }

    }

    }

   

    public void processItem()

    {

    if (this.canProcess())

    {

    // Get the correct soak entry for the inputs

    soakEntry resultEntry = null;

    for (int p = 0; p < processingEntries.size() && resultEntry == null; p++)

    {

    if (((soakEntry) processingEntries.get(p)).getItemInput() == this.itemStacks[1])

    {

    if (((soakEntry) processingEntries.get(p)).getFluidInput() == this.theFluid.getFluid())

    {

    resultEntry = (soakEntry) processingEntries.get(p);

    }

    }

    }

    if (resultEntry != null)

    {

    this.itemStacks[1] = resultEntry.getItemOutput();

    this.theFluid.setFluid(resultEntry.getFluidOutput());

    }

   

    }

    }

   

    public void readFromNBT(NBTTagCompound tag)

    {

        super.readFromNBT(tag);

        NBTTagList nbttaglist = tag.getTagList("Items", 10);

        itemStacks = new ItemStack[getSizeInventory()];

       

        for (int i = 0; i < nbttaglist.tagCount(); ++i)

        {

        NBTTagCompound tag1 = nbttaglist.getCompoundTagAt(i);

        int j = tag1.getByte("Slot") & 255;

       

        if (j >= 0 && j < itemStacks.length)

        {

        itemStacks[j] = ItemStack.loadItemStackFromNBT(tag1);

        }

        }

    }

 

    public void writeToNBT(NBTTagCompound tag)

    {

    super.writeToNBT(tag);

        NBTTagList nbttaglist = new NBTTagList();

 

        for (int i = 0; i < itemStacks.length; ++i)

        {

            if (itemStacks != null)

            {

                NBTTagCompound nbttagcompound1 = new NBTTagCompound();

                nbttagcompound1.setByte("Slot", (byte)i);

                itemStacks.writeToNBT(nbttagcompound1);

                nbttaglist.appendTag(nbttagcompound1);

            }

        }

    }

   

    @Override

public Packet getDescriptionPacket() {

NBTTagCompound nbtTag = new NBTTagCompound();

writeToNBT(nbtTag);

return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbtTag);

}

 

@Override

public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {

readFromNBT(packet.func_148857_g());

}

   

 

}

 

 

 

Link to comment
Share on other sites

 public void writeToNBT(NBTTagCompound tag)
    {
       super.writeToNBT(tag);
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 0; i < itemStacks.length; ++i)
        {
            if (itemStacks[i] != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setByte("Slot", (byte)i);
                itemStacks[i].writeToNBT(nbttagcompound1);
                nbttaglist.appendTag(nbttagcompound1);
            }
        }
    }

 

At what point were you planning on adding

nbttaglist

to

tag

?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It seems I'm still having some interesting problems.  I was having problems equating item stacks but that has now been resolved.  Fluids are being input into the machine correctly, but when I go to the GUI, the items appear to be invisible.  I can click on the locations where the items are supposed to be at and get the items, but they don't appear in the GUI.  Items are still not being saved when exiting the world.

 

My NBT and Update functions are the only ones that changed

 

[spoiler=NBT and Update functions]

    public void writeToNBT(NBTTagCompound tag)
    {
    	super.writeToNBT(tag);
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 0; i < itemStacks.length; ++i)
        {
            if (itemStacks[i] != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setByte("Slot", (byte)i);
                itemStacks[i].writeToNBT(nbttagcompound1);
                nbttaglist.appendTag(nbttagcompound1);
            }
        }
        tag.setTag("Items", nbttaglist);
        tag.setInteger("progress", progress);
        if (theFluid.getFluid() == null || theFluid.getFluidAmount() == 0)
        {
        	tag.setInteger("FluidID", -1);
        }
        else
        	tag.setInteger("FluidID", theFluid.getFluid().fluidID);
        tag.setInteger("FluidAmount", theFluid.getFluidAmount());
    }

 

 

Link to comment
Share on other sites

What is this?

itemStacks.writeToNBT(nbttagcompound1);

 

Because he didn't wrap it in a [nobbc]

[/nobbc] tag, the [nobbc][i][/nobbc] got dropped.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

show also your readFromNBT function.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Sorry about that.  Meant to include that with the update statement if the spoiler thing in the previous post didn't indicate that.

[spoiler=writeNBT]

    public void writeToNBT(NBTTagCompound tag)
    {
    	super.writeToNBT(tag);
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 0; i < itemStacks.length; ++i)
        {
            if (itemStacks[i] != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setByte("Slot", (byte)i);
                itemStacks[i].writeToNBT(nbttagcompound1);
                nbttaglist.appendTag(nbttagcompound1);
            }
        }
        tag.setTag("Items", nbttaglist);
        tag.setInteger("progress", progress);
        if (theFluid.getFluid() == null || theFluid.getFluidAmount() == 0)
        {
        	tag.setInteger("FluidID", -1);
        }
        else
        	tag.setInteger("FluidID", theFluid.getFluid().fluidID);
        tag.setInteger("FluidAmount", theFluid.getFluidAmount());
    }

 

 

[spoiler=ReadNBT]

    public void readFromNBT(NBTTagCompound tag)
    {
        super.readFromNBT(tag);
        NBTTagList nbttaglist = tag.getTagList("Items", 3);
        itemStacks = new ItemStack[getSizeInventory()];
        progress = tag.getInteger("progress");
        if (tag.getInteger("FluidID") >= 0)
        {
        	Fluid storedFluid = FluidRegistry.getFluid(tag.getInteger("FluidID"));
        	int fluidAmt = tag.getInteger("FluidAmount");
            theFluid.setFluid(new FluidStack(storedFluid, fluidAmt));
        }
        
        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
        	NBTTagCompound tag1 = nbttaglist.getCompoundTagAt(i);
        	int j = tag1.getByte("Slot") & 255;
        	
        	if (j >= 0 && j < itemStacks.length)
        	{
        		itemStacks[j] = ItemStack.loadItemStackFromNBT(tag1);
        	}
        }
        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
    }

 

 

Some of the code from updateEntity() was commented out so I could test stuff.  This is what is running.

[spoiler=updateEntity]

    @Override public void updateEntity()
    {
    	if (!this.worldObj.isRemote)
    	{
    		if (this.canFill())
    		{
    			fillTank();
    		}
    		if (theFluid != null && theFluid.getFluid() != null && theFluid.getFluidAmount() > 0)
    		{
    			itemStacks[2] = new ItemStack(Items.cake);
    		}
		if (this.worldObj != null)
		{
			this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
		}
		markDirty();
    	}
}

 

 

Link to comment
Share on other sites

Basically this thread has something with container code, so it'll be okay to post here.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • it crashed again     What the console says : [00:02:03] [Server thread/INFO] [Easy NPC/]: [EntityManager] Server started! [00:02:03] [Server thread/INFO] [co.gi.al.ic.IceAndFire/]: {iceandfire:fire_dragon_roost=true, iceandfire:fire_lily=true, iceandfire:spawn_dragon_skeleton_fire=true, iceandfire:lightning_dragon_roost=true, iceandfire:spawn_dragon_skeleton_lightning=true, iceandfire:ice_dragon_roost=true, iceandfire:ice_dragon_cave=true, iceandfire:lightning_dragon_cave=true, iceandfire:cyclops_cave=true, iceandfire:spawn_wandering_cyclops=true, iceandfire:spawn_sea_serpent=true, iceandfire:frost_lily=true, iceandfire:hydra_cave=true, iceandfire:lightning_lily=true, iceandfireixie_village=true, iceandfire:myrmex_hive_jungle=true, iceandfire:myrmex_hive_desert=true, iceandfire:silver_ore=true, iceandfire:siren_island=true, iceandfire:spawn_dragon_skeleton_ice=true, iceandfire:spawn_stymphalian_bird=true, iceandfire:fire_dragon_cave=true, iceandfire:sapphire_ore=true, iceandfire:spawn_hippocampus=true, iceandfire:spawn_death_worm=true} [00:02:03] [Server thread/INFO] [co.gi.al.ic.IceAndFire/]: {TROLL_S=true, HIPPOGRYPH=true, AMPHITHERE=true, COCKATRICE=true, TROLL_M=true, DREAD_LICH=true, TROLL_F=true} [00:02:03] [Server thread/INFO] [ne.be.lo.WeaponRegistry/]: Encoded Weapon Attribute registry size (with package overhead): 41976 bytes (in 5 string chunks with the size of 10000) [00:02:03] [Server thread/INFO] [patchouli/]: Sending reload packet to clients [00:02:03] [Server thread/WARN] [voicechat/]: [voicechat] Running in offline mode - Voice chat encryption is not secure! [00:02:03] [VoiceChatServerThread/INFO] [voicechat/]: [voicechat] Using server-ip as bind address: 0.0.0.0 [00:02:03] [Server thread/WARN] [ModernFix/]: Dedicated server took 22.521 seconds to load [00:02:03] [VoiceChatServerThread/INFO] [voicechat/]: [voicechat] Voice chat server started at 0.0.0.0:25565 [00:02:03] [Server thread/WARN] [minecraft/SynchedEntityData]: defineId called for: class net.minecraft.world.entity.player.Player from class tschipp.carryon.common.carry.CarryOnDataManager [00:02:03] [Server thread/INFO] [ne.mi.co.AdvancementLoadFix/]: Using new advancement loading for net.minecraft.server.PlayerAdvancements@2941ffd5 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 0 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 1 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 2 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 3 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 4 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 5 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 6 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 7 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 8 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 9 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 10 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 11 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 12 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 13 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 14 [00:02:19] [Server thread/INFO] [ne.mi.co.AdvancementLoadFix/]: Using new advancement loading for net.minecraft.server.PlayerAdvancements@ebc7ef2 [00:02:19] [Server thread/INFO] [minecraft/PlayerList]: ZacAdos[/90.2.17.162:49242] logged in with entity id 1062 at (-1848.6727005281205, 221.0, -3054.2468255848935) [00:02:19] [Server thread/ERROR] [ModernFix/]: Skipping entity ID sync for com.talhanation.smallships.world.entity.ship.Ship: java.lang.NoClassDefFoundError: net/minecraft/client/CameraType [00:02:19] [Server thread/INFO] [minecraft/MinecraftServer]: - Gloop - ZacAdos joined the game [00:02:19] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Updating all forceload tickets for cc56befd-d376-3526-a760-340713c478bd [00:02:19] [Server thread/INFO] [se.mi.te.da.DataManager/]: Sending data to client: ZacAdos [00:02:19] [Server thread/INFO] [voicechat/]: [voicechat] Received secret request of - Gloop - ZacAdos (17) [00:02:19] [Server thread/INFO] [voicechat/]: [voicechat] Sent secret to - Gloop - ZacAdos [00:02:21] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Successfully authenticated player cc56befd-d376-3526-a760-340713c478bd [00:02:22] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Successfully validated connection of player cc56befd-d376-3526-a760-340713c478bd [00:02:22] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Player - Gloop - ZacAdos (cc56befd-d376-3526-a760-340713c478bd) successfully connected to voice chat stop [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping the server [00:02:34] [Server thread/INFO] [mo.pl.ar.ArmourersWorkshop/]: stop local service [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [00:02:34] [Server thread/INFO] [minecraft/ServerGamePacketListenerImpl]: ZacAdos lost connection: Server closed [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: - Gloop - ZacAdos left the game [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Updating all forceload tickets for cc56befd-d376-3526-a760-340713c478bd [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_end [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_nether [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (world): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage: All dimensions are saved [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Stopping IO worker... [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Stopped IO worker! [00:02:34] [Server thread/INFO] [Calio/]: Removing Dynamic Registries for: net.minecraft.server.dedicated.DedicatedServer@7dc879e1 [MineStrator Daemon]: Checking server disk space usage, this could take a few seconds... [MineStrator Daemon]: Updating process configuration files... [MineStrator Daemon]: Ensuring file permissions are set correctly, this could take a few seconds... [MineStrator Daemon]: Pulling Docker container image, this could take a few minutes to complete... [MineStrator Daemon]: Finished pulling Docker container image container@pterodactyl~ java -version openjdk version "17.0.10" 2024-01-16 OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7) OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode, sharing) container@pterodactyl~ java -Xms128M -Xmx6302M -Dterminal.jline=false -Dterminal.ansi=true -Djline.terminal=jline.UnsupportedTerminal -p libraries/cpw/mods/bootstraplauncher/1.1.2/bootstraplauncher-1.1.2.jar:libraries/cpw/mods/securejarhandler/2.1.4/securejarhandler-2.1.4.jar:libraries/org/ow2/asm/asm-commons/9.5/asm-commons-9.5.jar:libraries/org/ow2/asm/asm-util/9.5/asm-util-9.5.jar:libraries/org/ow2/asm/asm-analysis/9.5/asm-analysis-9.5.jar:libraries/org/ow2/asm/asm-tree/9.5/asm-tree-9.5.jar:libraries/org/ow2/asm/asm/9.5/asm-9.5.jar:libraries/net/minecraftforge/JarJarFileSystems/0.3.16/JarJarFileSystems-0.3.16.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar=cpw.mods.securejarhandler --add-opens java.base/java.lang.invoke=cpw.mods.securejarhandler --add-exports java.base/sun.security.util=cpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Djava.net.preferIPv6Addresses=system -DignoreList=bootstraplauncher-1.1.2.jar,securejarhandler-2.1.4.jar,asm-commons-9.5.jar,asm-util-9.5.jar,asm-analysis-9.5.jar,asm-tree-9.5.jar,asm-9.5.jar,JarJarFileSystems-0.3.16.jar -DlibraryDirectory=libraries -DlegacyClassPath=libraries/cpw/mods/securejarhandler/2.1.4/securejarhandler-2.1.4.jar:libraries/org/ow2/asm/asm/9.5/asm-9.5.jar:libraries/org/ow2/asm/asm-commons/9.5/asm-commons-9.5.jar:libraries/org/ow2/asm/asm-tree/9.5/asm-tree-9.5.jar:libraries/org/ow2/asm/asm-util/9.5/asm-util-9.5.jar:libraries/org/ow2/asm/asm-analysis/9.5/asm-analysis-9.5.jar:libraries/net/minecraftforge/accesstransformers/8.0.4/accesstransformers-8.0.4.jar:libraries/org/antlr/antlr4-runtime/4.9.1/antlr4-runtime-4.9.1.jar:libraries/net/minecraftforge/eventbus/6.0.3/eventbus-6.0.3.jar:libraries/net/minecraftforge/forgespi/6.0.0/forgespi-6.0.0.jar:libraries/net/minecraftforge/coremods/5.0.1/coremods-5.0.1.jar:libraries/cpw/mods/modlauncher/10.0.8/modlauncher-10.0.8.jar:libraries/net/minecraftforge/unsafe/0.2.0/unsafe-0.2.0.jar:libraries/com/electronwill/night-config/core/3.6.4/core-3.6.4.jar:libraries/com/electronwill/night-config/toml/3.6.4/toml-3.6.4.jar:libraries/org/apache/maven/maven-artifact/3.8.5/maven-artifact-3.8.5.jar:libraries/net/jodah/typetools/0.8.3/typetools-0.8.3.jar:libraries/net/minecrell/terminalconsoleappender/1.2.0/terminalconsoleappender-1.2.0.jar:libraries/org/jline/jline-reader/3.12.1/jline-reader-3.12.1.jar:libraries/org/jline/jline-terminal/3.12.1/jline-terminal-3.12.1.jar:libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar:libraries/org/openjdk/nashorn/nashorn-core/15.3/nashorn-core-15.3.jar:libraries/net/minecraftforge/JarJarSelector/0.3.16/JarJarSelector-0.3.16.jar:libraries/net/minecraftforge/JarJarMetadata/0.3.16/JarJarMetadata-0.3.16.jar:libraries/net/minecraftforge/fmlloader/1.19.2-43.3.0/fmlloader-1.19.2-43.3.0.jar:libraries/net/minecraft/server/1.19.2-20220805.130853/server-1.19.2-20220805.130853-extra.jar:libraries/com/github/oshi/oshi-core/5.8.5/oshi-core-5.8.5.jar:libraries/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar:libraries/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:libraries/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar:libraries/com/mojang/authlib/3.11.49/authlib-3.11.49.jar:libraries/com/mojang/brigadier/1.0.18/brigadier-1.0.18.jar:libraries/com/mojang/datafixerupper/5.0.28/datafixerupper-5.0.28.jar:libraries/com/mojang/javabridge/1.2.24/javabridge-1.2.24.jar:libraries/com/mojang/logging/1.0.0/logging-1.0.0.jar:libraries/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:libraries/io/netty/netty-buffer/4.1.77.Final/netty-buffer-4.1.77.Final.jar:libraries/io/netty/netty-codec/4.1.77.Final/netty-codec-4.1.77.Final.jar:libraries/io/netty/netty-common/4.1.77.Final/netty-common-4.1.77.Final.jar:libraries/io/netty/netty-handler/4.1.77.Final/netty-handler-4.1.77.Final.jar:libraries/io/netty/netty-resolver/4.1.77.Final/netty-resolver-4.1.77.Final.jar:libraries/io/netty/netty-transport/4.1.77.Final/netty-transport-4.1.77.Final.jar:libraries/io/netty/netty-transport-classes-epoll/4.1.77.Final/netty-transport-classes-epoll-4.1.77.Final.jar:libraries/io/netty/netty-transport-native-epoll/4.1.77.Final/netty-transport-native-epoll-4.1.77.Final-linux-x86_64.jar:libraries/io/netty/netty-transport-native-epoll/4.1.77.Final/netty-transport-native-epoll-4.1.77.Final-linux-aarch_64.jar:libraries/io/netty/netty-transport-native-unix-common/4.1.77.Final/netty-transport-native-unix-common-4.1.77.Final.jar:libraries/it/unimi/dsi/fastutil/8.5.6/fastutil-8.5.6.jar:libraries/net/java/dev/jna/jna/5.10.0/jna-5.10.0.jar:libraries/net/java/dev/jna/jna-platform/5.10.0/jna-platform-5.10.0.jar:libraries/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:libraries/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar:libraries/org/apache/logging/log4j/log4j-api/2.17.0/log4j-api-2.17.0.jar:libraries/org/apache/logging/log4j/log4j-core/2.17.0/log4j-core-2.17.0.jar:libraries/org/apache/logging/log4j/log4j-slf4j18-impl/2.17.0/log4j-slf4j18-impl-2.17.0.jar:libraries/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar cpw.mods.bootstraplauncher.BootstrapLauncher --launchTarget forgeserver --fml.forgeVersion 43.3.0 --fml.mcVersion 1.19.2 --fml.forgeGroup net.minecraftforge --fml.mcpVersion 20220805.130853 [00:02:42] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 43.3.0, --fml.mcVersion, 1.19.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220805.130853] [00:02:42] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.10 by Eclipse Adoptium; OS Linux arch amd64 version 6.1.0-12-amd64 [00:02:43] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/home/container/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2363!/ Service=ModLauncher Env=SERVER [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/fmlcore/1.19.2-43.3.0/fmlcore-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/javafmllanguage/1.19.2-43.3.0/javafmllanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/lowcodelanguage/1.19.2-43.3.0/lowcodelanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/mclanguage/1.19.2-43.3.0/mclanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:44] [main/WARN] [ne.mi.ja.se.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File: and Mod File: . Using Mod File: [00:02:44] [main/WARN] [ne.mi.ja.se.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: resourcefullib. Using Mod File: /home/container/mods/resourcefullib-forge-1.19.2-1.1.24.jar [00:02:44] [main/INFO] [ne.mi.fm.lo.mo.JarInJarDependencyLocator/]: Found 13 dependencies adding them to mods collection Latest log [29Mar2024 00:02:42.803] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 43.3.0, --fml.mcVersion, 1.19.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220805.130853] [29Mar2024 00:02:42.805] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.10 by Eclipse Adoptium; OS Linux arch amd64 version 6.1.0-12-amd64 [29Mar2024 00:02:43.548] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/home/container/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2363!/ Service=ModLauncher Env=SERVER [29Mar2024 00:02:43.876] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/fmlcore/1.19.2-43.3.0/fmlcore-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.877] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/javafmllanguage/1.19.2-43.3.0/javafmllanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.877] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/lowcodelanguage/1.19.2-43.3.0/lowcodelanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.878] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/mclanguage/1.19.2-43.3.0/mclanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:44.033] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File: and Mod File: . Using Mod File: [29Mar2024 00:02:44.034] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: resourcefullib. Using Mod File: /home/container/mods/resourcefullib-forge-1.19.2-1.1.24.jar [29Mar2024 00:02:44.034] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 13 dependencies adding them to mods collection
    • I am unable to do that. Brigadier is a mojang library that parses commands.
    • Hi, i appreciate the answer. I would love to do that, but we have active players with all their belongings in SSN. Also this mod is really handy and they would be mad if we removed it. Are you really certain that SSN is causing this? It would require lots of work to test it and SSN was not really an issue before we removed Fast Suite. Can it be related somehow? I will provide you with log before removing FS. PasteBin: https://pastebin.com/Y5EpLpNe (crash before removing Fast Suite, which I suspected to be a problem from some crash before)
    • Backup the world and make a test without storagenetwork
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.