Fixed #396 - Dust block place on wall material bug
This commit is contained in:
parent
f12fa958e4
commit
53f833b094
14 changed files with 55 additions and 79 deletions
|
@ -45,6 +45,14 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical
|
|||
public void initiate()
|
||||
{
|
||||
mechanicalNode.reconstruct();
|
||||
super.initiate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
mechanicalNode.deconstruct();
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
package resonantinduction.core;
|
||||
|
||||
import resonantinduction.core.grid.UpdateTicker;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.ProxyBase;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package resonantinduction.core.fluid;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
@ -10,7 +8,6 @@ import net.minecraftforge.fluids.IFluidHandler;
|
|||
import universalelectricity.api.net.IUpdate;
|
||||
import universalelectricity.core.net.NetworkTickHandler;
|
||||
import universalelectricity.core.net.NodeNetwork;
|
||||
import calclavia.lib.utility.FluidUtility;
|
||||
|
||||
/**
|
||||
* The fluid network for instantaneous equal distribution between all nodes. Used for tanks.
|
||||
|
|
|
@ -1,33 +1,14 @@
|
|||
package resonantinduction.core.fluid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import resonantinduction.api.IInformation;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiverWithID;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||
import calclavia.lib.utility.FluidUtility;
|
||||
import calclavia.lib.utility.WorldUtility;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A prefab class for tiles that use the fluid network.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package resonantinduction.core.fluid;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
@ -9,7 +8,6 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import resonantinduction.core.grid.fluid.IPressureNodeProvider;
|
||||
import resonantinduction.core.grid.fluid.PressureNode;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiverWithID;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,9 +6,6 @@ import java.util.Iterator;
|
|||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import universalelectricity.api.net.IUpdate;
|
||||
import universalelectricity.core.net.ConnectionPathfinder;
|
||||
|
||||
/**
|
||||
* A grid specifying a connection with a series of nodes.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,6 @@ package resonantinduction.core.grid;
|
|||
import java.util.AbstractMap;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
package resonantinduction.core.grid;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import universalelectricity.api.net.IConnectable;
|
||||
import universalelectricity.api.net.IUpdate;
|
||||
|
||||
public abstract class NodeGrid<N extends Node> extends Grid<N>
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package resonantinduction.core.grid;
|
||||
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import universalelectricity.api.net.IUpdate;
|
||||
import universalelectricity.core.net.NetworkTickHandler;
|
||||
|
||||
public class TickingGrid<N extends Node> extends NodeGrid<N> implements IUpdate
|
||||
{
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package resonantinduction.core.grid;
|
||||
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event;
|
||||
import universalelectricity.api.net.IUpdate;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
/**
|
||||
* A ticker to update all grids. This is multithreaded.
|
||||
*
|
||||
|
|
|
@ -11,10 +11,8 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.mechanical.fluid.IPressure;
|
||||
import resonantinduction.core.grid.Grid;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.core.grid.TickingGrid;
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
|
@ -192,7 +190,7 @@ public class PressureNode extends Node<IPressureNodeProvider, TickingGrid, Objec
|
|||
{
|
||||
TileEntity tile = position().translate(dir).getTileEntity(world());
|
||||
|
||||
if (tile instanceof IMechanicalNodeProvider)
|
||||
if (tile instanceof IPressureNodeProvider)
|
||||
{
|
||||
PressureNode check = ((IPressureNodeProvider) tile).getNode(dir.getOpposite());
|
||||
|
||||
|
|
|
@ -7,13 +7,11 @@ import java.util.List;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemShears;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import resonantinduction.core.MultipartUtility;
|
||||
import resonantinduction.electrical.charger.PartCharger;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import scala.annotation.meta.setter;
|
||||
import calclavia.lib.prefab.block.BlockTile;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -34,17 +35,6 @@ public class BlockDust extends BlockTile
|
|||
setStepSound(soundGravelFootstep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLivingBase, ItemStack itemStack)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileMaterial)
|
||||
{
|
||||
((TileMaterial) tileEntity).name = ItemOreResource.getMaterialFromStack(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess access, int x, int y, int z)
|
||||
|
@ -59,10 +49,27 @@ public class BlockDust extends BlockTile
|
|||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLivingBase, ItemStack itemStack)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileMaterial)
|
||||
{
|
||||
((TileMaterial) tileEntity).name = ItemOreResource.getMaterialFromStack(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostBlockPlaced(World world, int x, int y, int z, int metadata)
|
||||
{
|
||||
tryToFall(world, y, x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
tryToFall(world, x, y, z);
|
||||
tryToFall(world, y, x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,28 +85,32 @@ public class BlockDust extends BlockTile
|
|||
if (tile instanceof TileMaterial)
|
||||
{
|
||||
String materialName = ((TileMaterial) tile).name;
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (canFallBelow(world, x, y - 1, z) && y >= 0)
|
||||
if (materialName != null)
|
||||
{
|
||||
byte b0 = 32;
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
while (canFallBelow(world, x, y - 1, z) && y > 0)
|
||||
if (canFallBelow(world, x, y - 1, z) && y >= 0)
|
||||
{
|
||||
--y;
|
||||
}
|
||||
byte b0 = 32;
|
||||
|
||||
if (y > 0)
|
||||
{
|
||||
world.setBlock(x, y, z, this.blockID, metadata, 3);
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
TileEntity newTile = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (newTile instanceof TileMaterial)
|
||||
while (canFallBelow(world, x, y - 1, z) && y > 0)
|
||||
{
|
||||
((TileMaterial) newTile).name = materialName;
|
||||
--y;
|
||||
}
|
||||
|
||||
if (y > 0)
|
||||
{
|
||||
world.setBlock(x, y, z, this.blockID, metadata, 3);
|
||||
|
||||
TileEntity newTile = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (newTile instanceof TileMaterial)
|
||||
{
|
||||
((TileMaterial) newTile).name = materialName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,13 +15,11 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import resonantinduction.api.recipe.MachineRecipes;
|
||||
import resonantinduction.api.recipe.MachineRecipes.RecipeType;
|
||||
import resonantinduction.api.recipe.RecipeResource;
|
||||
import resonantinduction.archaic.Archaic;
|
||||
import resonantinduction.archaic.fluid.gutter.TileGutter;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.TabRI;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.utility.FluidUtility;
|
||||
import calclavia.lib.utility.LanguageUtility;
|
||||
import calclavia.lib.utility.inventory.InventoryUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
|
Loading…
Reference in a new issue