Merge branch 'master' of https://github.com/TechReborn/TechReborn
This commit is contained in:
commit
2ed801eeb2
31 changed files with 112 additions and 601 deletions
|
@ -92,7 +92,7 @@ public class Core {
|
|||
RecipeManager.init();
|
||||
//Has to be done after the recipes have been added
|
||||
CompatManager.postInit(event);
|
||||
//RecipeHanderer.addOreDicRecipes();
|
||||
|
||||
LogHelper.info(RecipeHanderer.recipeList.size() + " recipes loaded");
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
/**
|
||||
* Extend this to add a recipe
|
||||
*/
|
||||
public abstract class BaseRecipe implements IBaseRecipeType {
|
||||
public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
|
||||
|
||||
public ArrayList<ItemStack> inputs;
|
||||
|
||||
|
@ -32,7 +32,7 @@ public abstract class BaseRecipe implements IBaseRecipeType {
|
|||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
return (List<ItemStack>) outputs.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,4 +64,9 @@ public abstract class BaseRecipe implements IBaseRecipeType {
|
|||
public boolean onCraft(TileEntity tile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone()throws CloneNotSupportedException{
|
||||
return super.clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,4 +57,6 @@ public interface IBaseRecipeType {
|
|||
* @return return true if fluid was taken and should craft
|
||||
*/
|
||||
public boolean onCraft(TileEntity tile);
|
||||
|
||||
public Object clone()throws CloneNotSupportedException;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ public class RecipeCrafter {
|
|||
}
|
||||
}
|
||||
if (canGiveInvAll) {
|
||||
currentRecipe = recipe;//Sets the current recipe then syncs
|
||||
setCurrentRecipe(recipe);//Sets the current recipe then syncs
|
||||
this.currentNeededTicks = (int)(currentRecipe.tickTime() * (1.0 - speedMultiplier));
|
||||
this.currentTickTime = 0;
|
||||
syncIsActive();
|
||||
|
@ -150,6 +150,7 @@ public class RecipeCrafter {
|
|||
ArrayList<Integer> filledSlots = new ArrayList<Integer>();//The slots that have been filled
|
||||
if (canGiveInvAll && currentRecipe.onCraft(parentTile)) {
|
||||
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) {
|
||||
System.out.println(currentRecipe.getOutputs().get(i).stackSize);
|
||||
if (!filledSlots.contains(outputSlots[i])) {//checks it has not been filled
|
||||
fitStack(currentRecipe.getOutputs().get(i), outputSlots[i]);//fills the slot with the output stack
|
||||
filledSlots.add(outputSlots[i]);
|
||||
|
@ -323,4 +324,12 @@ public class RecipeCrafter {
|
|||
return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord,
|
||||
this.parentTile.zCoord, 1, nbtTag);
|
||||
}
|
||||
|
||||
public void setCurrentRecipe(IBaseRecipeType recipe){
|
||||
try {
|
||||
this.currentRecipe = (IBaseRecipeType) recipe.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ public class RecipeHanderer {
|
|||
/**
|
||||
* This is the array list of all of the recipes for all of the machines
|
||||
*/
|
||||
public static ArrayList<IBaseRecipeType> recipeList = new ArrayList<IBaseRecipeType>();
|
||||
public static final ArrayList<IBaseRecipeType> recipeList = new ArrayList<IBaseRecipeType>();
|
||||
|
||||
/**
|
||||
* This is a backedup clone of the master recipeList
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.util.MathHelper;
|
|||
import net.minecraft.world.World;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockMachineBase extends BlockContainer{
|
||||
public class BlockMachineBase extends BlockContainer {
|
||||
|
||||
public BlockMachineBase(Material material)
|
||||
{
|
||||
|
|
|
@ -1,164 +0,0 @@
|
|||
/*
|
||||
* This file was made by modmuss50. View the licence file to see what licence this is is on. You can always ask me if you would like to use part or all of this file in your project.
|
||||
*/
|
||||
|
||||
package techreborn.partSystem.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.ICustomHighlight;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
||||
/**
|
||||
* Created by mark on 10/12/14.
|
||||
*/
|
||||
public class BlockModPart extends BlockContainer implements ICustomHighlight {
|
||||
|
||||
public BlockModPart(Material met) {
|
||||
super(met);
|
||||
}
|
||||
|
||||
public static TileEntityModPart get(IBlockAccess world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te == null)
|
||||
return null;
|
||||
if (!(te instanceof TileEntityModPart))
|
||||
return null;
|
||||
return (TileEntityModPart) te;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityModPart();
|
||||
}
|
||||
|
||||
@SuppressWarnings(
|
||||
{"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z,
|
||||
AxisAlignedBB bounds, List l, Entity entity) {
|
||||
TileEntityModPart te = get(world, x, y, z);
|
||||
if (te == null)
|
||||
return;
|
||||
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
te.addCollisionBoxesToList(boxes, bounds, entity);
|
||||
for (Vecs3dCube c : boxes)
|
||||
l.add(c.toAABB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO move to array list
|
||||
public ArrayList<AxisAlignedBB> getBoxes(World world, int x, int y, int z,
|
||||
EntityPlayer player) {
|
||||
TileEntityModPart te = get(world, x, y, z);
|
||||
if (te == null)
|
||||
return null;
|
||||
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
ArrayList<AxisAlignedBB> list = new ArrayList<AxisAlignedBB>();
|
||||
if (!te.getParts().isEmpty()) {
|
||||
for (ModPart modPart : te.getParts())
|
||||
boxes.addAll(modPart.getSelectionBoxes());
|
||||
for (int i = 0; i < boxes.size(); i++) {
|
||||
Vecs3dCube cube = boxes.get(i);
|
||||
list.add(cube.toAABB());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z,
|
||||
Block block) {
|
||||
for (ModPart part : get(world, x, y, z).getParts()) {
|
||||
part.nearByChange();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World wrd, int x, int y,
|
||||
int z, Vec3 origin, Vec3 direction) {
|
||||
ArrayList<AxisAlignedBB> aabbs = getBoxes(wrd, x, y, z, null);
|
||||
MovingObjectPosition closest = null;
|
||||
for (AxisAlignedBB aabb : aabbs) {
|
||||
MovingObjectPosition mop = aabb.getOffsetBoundingBox(x, y, z)
|
||||
.calculateIntercept(origin, direction);
|
||||
if (mop != null) {
|
||||
if (closest != null
|
||||
&& mop.hitVec.distanceTo(origin) < closest.hitVec
|
||||
.distanceTo(origin)) {
|
||||
closest = mop;
|
||||
} else {
|
||||
closest = mop;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (closest != null) {
|
||||
closest.blockX = x;
|
||||
closest.blockY = y;
|
||||
closest.blockZ = z;
|
||||
}
|
||||
return closest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
for (ModPart part : get(world, x, y, z).getParts()) {
|
||||
part.onAdded();
|
||||
}
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block oldid,
|
||||
int oldmeta) {
|
||||
for (ModPart part : get(world, x, y, z).getParts()) {
|
||||
part.onRemoved();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, oldid, oldmeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z,
|
||||
int metadata, int fortune) {
|
||||
ArrayList<ItemStack> l = new ArrayList<ItemStack>();
|
||||
TileEntityModPart te = get(world, x, y, z);
|
||||
if (te != null) {
|
||||
for (IModPart p : te.getParts()) {
|
||||
ItemStack item = p.getItem();
|
||||
if (item != null)
|
||||
l.add(item);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* This file was made by modmuss50. View the licence file to see what licence this is is on. You can always ask me if you would like to use part or all of this file in your project.
|
||||
*/
|
||||
|
||||
package techreborn.partSystem.block;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
||||
public class RenderModPart extends TileEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y,
|
||||
double z, float delta) {
|
||||
TileEntityModPart te = (TileEntityModPart) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
{
|
||||
for (ModPart modPart : te.getParts()) {
|
||||
modPart.renderDynamic(new Vecs3d(0, 0, 0), delta);
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -1,252 +0,0 @@
|
|||
/*
|
||||
* This file was made by modmuss50. View the licence file to see what licence this is is on. You can always ask me if you would like to use part or all of this file in your project.
|
||||
*/
|
||||
|
||||
package techreborn.partSystem.block;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
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.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import techreborn.partSystem.ModPartRegistry;
|
||||
import techreborn.partSystem.parts.CablePart;
|
||||
import techreborn.partSystem.parts.NullPart;
|
||||
|
||||
public class TileEntityModPart extends TileEntity {
|
||||
|
||||
private Map<String, ModPart> parts = new HashMap<String, ModPart>();
|
||||
|
||||
public void addCollisionBoxesToList(List<Vecs3dCube> l,
|
||||
AxisAlignedBB bounds, Entity entity) {
|
||||
if (getParts().size() == 0)
|
||||
addPart(new NullPart());
|
||||
List<Vecs3dCube> boxes2 = new ArrayList<Vecs3dCube>();
|
||||
for (ModPart mp : getParts()) {
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
mp.addCollisionBoxesToList(boxes, entity);
|
||||
|
||||
for (int i = 0; i < boxes.size(); i++) {
|
||||
Vecs3dCube cube = boxes.get(i).clone();
|
||||
cube.add(getX(), getY(), getZ());
|
||||
boxes2.add(cube);
|
||||
}
|
||||
}
|
||||
|
||||
for (Vecs3dCube c : boxes2) {
|
||||
// if (c.toAABB().intersectsWith(bounds))
|
||||
l.add(c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<Vecs3dCube> getOcclusionBoxes() {
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
for (ModPart mp : getParts()) {
|
||||
boxes.addAll(mp.getOcclusionBoxes());
|
||||
}
|
||||
return boxes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1,
|
||||
yCoord + 1, zCoord + 1);
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return getWorldObj();
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (parts.isEmpty()) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
for (ModPart mp : getParts()) {
|
||||
if (mp.world != null && mp.location != null) {
|
||||
mp.tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
|
||||
super.writeToNBT(tag);
|
||||
|
||||
NBTTagList l = new NBTTagList();
|
||||
writeParts(l, false);
|
||||
tag.setTag("parts", l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
|
||||
super.readFromNBT(tag);
|
||||
|
||||
NBTTagList l = tag.getTagList("parts", new NBTTagCompound().getId());
|
||||
try {
|
||||
readParts(l);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeParts(NBTTagList l, boolean update) {
|
||||
|
||||
for (ModPart p : getParts()) {
|
||||
String id = getIdentifier(p);
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
tag.setString("id", id);
|
||||
tag.setString("type", p.getName());
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
p.writeToNBT(data);
|
||||
tag.setTag("data", data);
|
||||
|
||||
l.appendTag(tag);
|
||||
}
|
||||
}
|
||||
|
||||
private void readParts(NBTTagList l) throws IllegalAccessException,
|
||||
InstantiationException {
|
||||
|
||||
for (int i = 0; i < l.tagCount(); i++) {
|
||||
NBTTagCompound tag = l.getCompoundTagAt(i);
|
||||
|
||||
String id = tag.getString("id");
|
||||
ModPart p = getPart(id);
|
||||
if (p == null) {
|
||||
for (ModPart modPart : ModPartRegistry.parts) {
|
||||
if (modPart.getName().equals(id)) {
|
||||
p = modPart.getClass().newInstance();
|
||||
}
|
||||
}
|
||||
if (p == null)
|
||||
continue;
|
||||
addPart(p);
|
||||
}
|
||||
|
||||
NBTTagCompound data = tag.getCompoundTag("data");
|
||||
p.readFromNBT(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void addPart(ModPart modPart) {
|
||||
ModPart newPart = null;
|
||||
try {
|
||||
if(modPart instanceof CablePart){
|
||||
try {
|
||||
newPart = modPart.getClass().getDeclaredConstructor(int.class).newInstance(((CablePart) modPart).type);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
newPart = modPart.getClass().newInstance();
|
||||
}
|
||||
newPart.setWorld(getWorldObj());
|
||||
newPart.setLocation(new Location(xCoord, yCoord, zCoord));
|
||||
parts.put(newPart.getName(), newPart);
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private ModPart getPart(String id) {
|
||||
for (String s : parts.keySet())
|
||||
if (s.equals(id))
|
||||
return parts.get(s);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getIdentifier(ModPart part) {
|
||||
for (String s : parts.keySet())
|
||||
if (parts.get(s).equals(part))
|
||||
return s;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
public List<ModPart> getParts() {
|
||||
List<ModPart> parts = new ArrayList<ModPart>();
|
||||
for (String s : this.parts.keySet()) {
|
||||
ModPart p = this.parts.get(s);
|
||||
parts.add(p);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
public List<String> getPartsByName() {
|
||||
List<String> parts = new ArrayList<String>();
|
||||
for (String s : this.parts.keySet()) {
|
||||
parts.add(s);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
public boolean canAddPart(ModPart modpart) {
|
||||
List<Vecs3dCube> cubes = new ArrayList<Vecs3dCube>();
|
||||
modpart.addCollisionBoxesToList(cubes, null);
|
||||
for (Vecs3dCube c : cubes)
|
||||
if (c != null
|
||||
&& !getWorld().checkNoEntityCollision(
|
||||
c.clone().add(getX(), getY(), getZ()).toAABB()))
|
||||
return false;
|
||||
|
||||
List<Vecs3dCube> l = getOcclusionBoxes();
|
||||
for (Vecs3dCube b : modpart.getOcclusionBoxes())
|
||||
for (Vecs3dCube c : l)
|
||||
if (c != null && b != null
|
||||
&& b.toAABB().intersectsWith(c.toAABB()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
* This file was made by modmuss50. View the licence file to see what licence this is is on. You can always ask me if you would like to use part or all of this file in your project.
|
||||
*/
|
||||
|
||||
package techreborn.partSystem.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Created by mark on 10/12/14.
|
||||
*/
|
||||
public class WorldProvider implements IPartProvider {
|
||||
Block blockModPart;
|
||||
|
||||
@Override
|
||||
public String modID() {
|
||||
return "Minecraft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPart() {
|
||||
// Loads all of the items
|
||||
|
||||
blockModPart = new BlockModPart(Material.ground)
|
||||
.setBlockName("modPartBlock");
|
||||
GameRegistry.registerBlock(blockModPart, "modPartBlock");
|
||||
|
||||
// registers the tile and renderer
|
||||
GameRegistry.registerTileEntity(TileEntityModPart.class,
|
||||
"TileEntityModPart");
|
||||
}
|
||||
|
||||
public void clientRegister() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityModPart.class,
|
||||
new RenderModPart());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkOcclusion(World world, Location location,
|
||||
Vecs3dCube cube) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPart(World world, Location location, String name) {
|
||||
TileEntity tileEntity = world.getTileEntity(location.getX(),
|
||||
location.getY(), location.getZ());
|
||||
if (tileEntity instanceof TileEntityModPart) {
|
||||
for (ModPart part : ((TileEntityModPart) tileEntity).getParts()) {
|
||||
if (part.getName().equals(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world,
|
||||
int x, int y, int z, int side, float hitX, float hitY, float hitZ,
|
||||
ModPart modPart) {
|
||||
ForgeDirection forgeDirection = ForgeDirection.getOrientation(side);
|
||||
if (world.getBlock(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z + forgeDirection.offsetZ) == Blocks.air) {
|
||||
TileEntityModPart modPart1;
|
||||
world.setBlock(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z + forgeDirection.offsetZ,
|
||||
blockModPart);
|
||||
modPart1 = (TileEntityModPart) world.getTileEntity(x
|
||||
+ forgeDirection.offsetX, y + forgeDirection.offsetY, z
|
||||
+ forgeDirection.offsetZ);
|
||||
// if(modPart1.canAddPart(modPart)){
|
||||
modPart1.addPart(modPart);
|
||||
return true;
|
||||
// }
|
||||
}
|
||||
// this adds a part to a block
|
||||
if (world.getBlock(x, y, z) == blockModPart) {
|
||||
TileEntityModPart tileEntityModPart = (TileEntityModPart) world
|
||||
.getTileEntity(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z
|
||||
+ forgeDirection.offsetZ);
|
||||
if (!tileEntityModPart.getPartsByName().contains(modPart.getName())
|
||||
&& tileEntityModPart.canAddPart(modPart))
|
||||
tileEntityModPart.addPart(modPart);
|
||||
return true;
|
||||
}
|
||||
if (world.getBlock(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z + forgeDirection.offsetZ) == blockModPart) {
|
||||
TileEntityModPart tileEntityModPart = (TileEntityModPart) world
|
||||
.getTileEntity(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z
|
||||
+ forgeDirection.offsetZ);
|
||||
if (!tileEntityModPart.getPartsByName().contains(modPart.getName())
|
||||
&& tileEntityModPart.canAddPart(modPart))
|
||||
tileEntityModPart.addPart(modPart);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTileFromProvider(TileEntity tileEntity) {
|
||||
return tileEntity instanceof TileEntityModPart;
|
||||
}
|
||||
|
||||
//TODO
|
||||
@Override
|
||||
public IModPart getPartFromWorld(World world, Location location, String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -402,10 +402,10 @@ public class CablePart extends ModPart implements IEnergyConductor {
|
|||
String p = null;
|
||||
switch(cableType) {
|
||||
case 0:
|
||||
p = "insulatedCopperCableItem";
|
||||
p = "copperCableItem";
|
||||
break;
|
||||
case 1:
|
||||
p = "copperCableItem";
|
||||
p = "insulatedCopperCableItem";
|
||||
break;
|
||||
case 2:
|
||||
p = "goldCableItem";
|
||||
|
|
|
@ -2,8 +2,6 @@ package techreborn.proxies;
|
|||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import techreborn.client.IconSupplier;
|
||||
import techreborn.partSystem.ModPartRegistry;
|
||||
import techreborn.partSystem.block.WorldProvider;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
|
@ -12,6 +10,5 @@ public class ClientProxy extends CommonProxy {
|
|||
{
|
||||
super.init();
|
||||
MinecraftForge.EVENT_BUS.register(new IconSupplier());
|
||||
ModPartRegistry.addProvider(new WorldProvider());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,14 +92,16 @@ public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IE
|
|||
}
|
||||
|
||||
@Override
|
||||
public void invalidate(){
|
||||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload(){
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -106,11 +106,13 @@ public class TileAssemblingMachine extends TileMachineBase implements IWrenchabl
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -241,15 +241,18 @@ public class TileBlastFurnace extends TileMachineBase implements IWrenchable, II
|
|||
return inventory.isItemValidForSlot(p_94041_1_, p_94041_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
energy.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
energy.onChunkUnload();
|
||||
}
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
|
|
|
@ -113,11 +113,13 @@ public class TileCentrifuge extends TileMachineBase implements IWrenchable, IEn
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -106,11 +106,13 @@ public class TileChemicalReactor extends TileMachineBase implements IWrenchable,
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,18 @@ public class TileChunkLoader extends TileMachineBase implements IWrenchable, IEn
|
|||
energy.updateEntity();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
|
||||
|
|
|
@ -85,11 +85,13 @@ public class TileDragonEggSiphoner extends TileMachineBase implements IWrenchabl
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -277,6 +277,7 @@ public class TileGasTurbine extends TileEntity implements IWrenchable,
|
|||
public void onChunkUnload()
|
||||
{
|
||||
energySource.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -101,12 +101,16 @@ public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergy
|
|||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
/* IFluidHandler */
|
||||
|
|
|
@ -102,11 +102,13 @@ public class TileHeatGenerator extends TileMachineBase implements IWrenchable, I
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -72,7 +72,8 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
System.out.println("hello");
|
||||
super.updateEntity();
|
||||
crafter.updateEntity();
|
||||
energy.updateEntity();
|
||||
}
|
||||
|
@ -109,11 +110,13 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -104,11 +104,13 @@ public class TileIndustrialElectrolyzer extends TileMachineBase implements IWren
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -108,11 +108,13 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -105,11 +105,13 @@ public class TileLathe extends TileMachineBase implements IWrenchable, IEnergyTi
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,11 +87,13 @@ public class TileMatterFabricator extends TileMachineBase implements IWrenchable
|
|||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -111,5 +111,18 @@ public class TilePlateCuttingMachine extends TileMachineBase implements IWrencha
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -192,4 +192,17 @@ public class TileRollingMachine extends TileMachineBase implements IWrenchable,
|
|||
tagCompound.setBoolean("isRunning", isRunning);
|
||||
tagCompound.setInteger("tickTime", tickTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
energy.invalidate();
|
||||
super.invalidate();
|
||||
}
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
energy.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,6 +283,7 @@ public class TileSemifluidGenerator extends TileEntity implements IWrenchable,
|
|||
public void onChunkUnload()
|
||||
{
|
||||
energySource.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -257,6 +257,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable,
|
|||
public void onChunkUnload()
|
||||
{
|
||||
energySource.onChunkUnload();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue