Fixed #396 - Dust block place on wall material bug

This commit is contained in:
Calclavia 2014-03-07 21:41:00 -08:00
parent f12fa958e4
commit 53f833b094
14 changed files with 55 additions and 79 deletions

View file

@ -45,6 +45,14 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical
public void initiate() public void initiate()
{ {
mechanicalNode.reconstruct(); mechanicalNode.reconstruct();
super.initiate();
}
@Override
public void invalidate()
{
mechanicalNode.deconstruct();
super.invalidate();
} }
@Override @Override

View file

@ -3,7 +3,6 @@
*/ */
package resonantinduction.core; package resonantinduction.core;
import resonantinduction.core.grid.UpdateTicker;
import net.minecraft.world.World; import net.minecraft.world.World;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.prefab.ProxyBase; import calclavia.lib.prefab.ProxyBase;

View file

@ -1,7 +1,5 @@
package resonantinduction.core.fluid; package resonantinduction.core.fluid;
import java.util.Set;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
@ -10,7 +8,6 @@ import net.minecraftforge.fluids.IFluidHandler;
import universalelectricity.api.net.IUpdate; import universalelectricity.api.net.IUpdate;
import universalelectricity.core.net.NetworkTickHandler; import universalelectricity.core.net.NetworkTickHandler;
import universalelectricity.core.net.NodeNetwork; import universalelectricity.core.net.NodeNetwork;
import calclavia.lib.utility.FluidUtility;
/** /**
* The fluid network for instantaneous equal distribution between all nodes. Used for tanks. * The fluid network for instantaneous equal distribution between all nodes. Used for tanks.

View file

@ -1,33 +1,14 @@
package resonantinduction.core.fluid; package resonantinduction.core.fluid;
import java.util.List;
import net.minecraft.block.material.Material; 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.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import resonantinduction.api.IInformation;
import resonantinduction.core.ResonantInduction;
import universalelectricity.api.vector.Vector3; 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 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. * A prefab class for tiles that use the fluid network.
* *

View file

@ -1,7 +1,6 @@
package resonantinduction.core.fluid; package resonantinduction.core.fluid;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -9,7 +8,6 @@ import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import resonantinduction.core.grid.fluid.IPressureNodeProvider; import resonantinduction.core.grid.fluid.IPressureNodeProvider;
import resonantinduction.core.grid.fluid.PressureNode; import resonantinduction.core.grid.fluid.PressureNode;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.network.IPacketReceiverWithID; import calclavia.lib.network.IPacketReceiverWithID;
/** /**

View file

@ -6,9 +6,6 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import universalelectricity.api.net.IUpdate;
import universalelectricity.core.net.ConnectionPathfinder;
/** /**
* A grid specifying a connection with a series of nodes. * A grid specifying a connection with a series of nodes.
* *

View file

@ -3,7 +3,6 @@ package resonantinduction.core.grid;
import java.util.AbstractMap; import java.util.AbstractMap;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;

View file

@ -1,18 +1,10 @@
package resonantinduction.core.grid; package resonantinduction.core.grid;
import java.util.AbstractMap; import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import net.minecraftforge.common.ForgeDirection; 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> public abstract class NodeGrid<N extends Node> extends Grid<N>
{ {

View file

@ -1,8 +1,6 @@
package resonantinduction.core.grid; package resonantinduction.core.grid;
import resonantinduction.mechanical.energy.network.MechanicalNode;
import universalelectricity.api.net.IUpdate; import universalelectricity.api.net.IUpdate;
import universalelectricity.core.net.NetworkTickHandler;
public class TickingGrid<N extends Node> extends NodeGrid<N> implements IUpdate public class TickingGrid<N extends Node> extends NodeGrid<N> implements IUpdate
{ {

View file

@ -1,15 +1,17 @@
package resonantinduction.core.grid; package resonantinduction.core.grid;
import cpw.mods.fml.common.ITickHandler; import java.util.Collections;
import cpw.mods.fml.common.TickType; import java.util.HashSet;
import net.minecraft.server.MinecraftServer; 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.common.MinecraftForge;
import net.minecraftforge.event.Event; import net.minecraftforge.event.Event;
import universalelectricity.api.net.IUpdate; import universalelectricity.api.net.IUpdate;
import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;
/** /**
* A ticker to update all grids. This is multithreaded. * A ticker to update all grids. This is multithreaded.
* *

View file

@ -11,10 +11,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.mechanical.fluid.IPressure; import resonantinduction.api.mechanical.fluid.IPressure;
import resonantinduction.core.grid.Grid;
import resonantinduction.core.grid.Node; import resonantinduction.core.grid.Node;
import resonantinduction.core.grid.TickingGrid; import resonantinduction.core.grid.TickingGrid;
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import codechicken.multipart.TMultiPart; import codechicken.multipart.TMultiPart;
@ -192,7 +190,7 @@ public class PressureNode extends Node<IPressureNodeProvider, TickingGrid, Objec
{ {
TileEntity tile = position().translate(dir).getTileEntity(world()); TileEntity tile = position().translate(dir).getTileEntity(world());
if (tile instanceof IMechanicalNodeProvider) if (tile instanceof IPressureNodeProvider)
{ {
PressureNode check = ((IPressureNodeProvider) tile).getNode(dir.getOpposite()); PressureNode check = ((IPressureNodeProvider) tile).getNode(dir.getOpposite());

View file

@ -7,13 +7,11 @@ import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockColored; import net.minecraft.block.BlockColored;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemShears; import net.minecraft.item.ItemShears;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import resonantinduction.core.MultipartUtility; import resonantinduction.core.MultipartUtility;
import resonantinduction.electrical.charger.PartCharger;
import codechicken.lib.data.MCDataInput; import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput; import codechicken.lib.data.MCDataOutput;

View file

@ -12,6 +12,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction; import resonantinduction.core.ResonantInduction;
import scala.annotation.meta.setter;
import calclavia.lib.prefab.block.BlockTile; import calclavia.lib.prefab.block.BlockTile;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -34,17 +35,6 @@ public class BlockDust extends BlockTile
setStepSound(soundGravelFootstep); 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) @SideOnly(Side.CLIENT)
@Override @Override
public int colorMultiplier(IBlockAccess access, int x, int y, int z) public int colorMultiplier(IBlockAccess access, int x, int y, int z)
@ -59,10 +49,27 @@ public class BlockDust extends BlockTile
return 16777215; 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 @Override
public void onBlockAdded(World world, int x, int y, int z) public void onBlockAdded(World world, int x, int y, int z)
{ {
tryToFall(world, x, y, z); tryToFall(world, y, x, z);
} }
@Override @Override
@ -78,6 +85,9 @@ public class BlockDust extends BlockTile
if (tile instanceof TileMaterial) if (tile instanceof TileMaterial)
{ {
String materialName = ((TileMaterial) tile).name; String materialName = ((TileMaterial) tile).name;
if (materialName != null)
{
int metadata = world.getBlockMetadata(x, y, z); int metadata = world.getBlockMetadata(x, y, z);
if (canFallBelow(world, x, y - 1, z) && y >= 0) if (canFallBelow(world, x, y - 1, z) && y >= 0)
@ -104,6 +114,7 @@ public class BlockDust extends BlockTile
} }
} }
} }
}
} }

View file

@ -15,13 +15,11 @@ import net.minecraftforge.oredict.OreDictionary;
import resonantinduction.api.recipe.MachineRecipes; import resonantinduction.api.recipe.MachineRecipes;
import resonantinduction.api.recipe.MachineRecipes.RecipeType; import resonantinduction.api.recipe.MachineRecipes.RecipeType;
import resonantinduction.api.recipe.RecipeResource; import resonantinduction.api.recipe.RecipeResource;
import resonantinduction.archaic.Archaic;
import resonantinduction.archaic.fluid.gutter.TileGutter; import resonantinduction.archaic.fluid.gutter.TileGutter;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction; import resonantinduction.core.ResonantInduction;
import resonantinduction.core.TabRI; import resonantinduction.core.TabRI;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.utility.FluidUtility;
import calclavia.lib.utility.LanguageUtility; import calclavia.lib.utility.LanguageUtility;
import calclavia.lib.utility.inventory.InventoryUtility; import calclavia.lib.utility.inventory.InventoryUtility;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;