mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Reconstructor Colors, Part 1
This commit is contained in:
parent
93fb24e736
commit
0a78782693
9 changed files with 188 additions and 11 deletions
|
@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.blocks;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import ellpeck.actuallyadditions.items.IReconstructorLens;
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
||||||
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
|
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
@ -102,9 +103,28 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IAct
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(x, y, z);
|
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(x, y, z);
|
||||||
if(reconstructor != null){
|
if(reconstructor != null){
|
||||||
player.addChatComponentMessage(new ChatComponentText(reconstructor.storage.getEnergyStored()+"/"+reconstructor.storage.getMaxEnergyStored()+" RF"));
|
if(!player.isSneaking()){
|
||||||
|
ItemStack heldItem = player.getCurrentEquippedItem();
|
||||||
|
if(heldItem != null){
|
||||||
|
if(heldItem.getItem() instanceof IReconstructorLens && reconstructor.getStackInSlot(0) == null){
|
||||||
|
ItemStack toPut = heldItem.copy();
|
||||||
|
toPut.stackSize = 1;
|
||||||
|
reconstructor.setInventorySlotContents(0, toPut);
|
||||||
|
|
||||||
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(reconstructor.getStackInSlot(0) != null){
|
||||||
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, reconstructor.getStackInSlot(0).copy());
|
||||||
|
reconstructor.setInventorySlotContents(0, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
player.addChatComponentMessage(new ChatComponentText(reconstructor.storage.getEnergyStored()+"/"+reconstructor.storage.getMaxEnergyStored()+" RF"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* This file ("ILens.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ellpeck.actuallyadditions.items;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
||||||
|
|
||||||
|
public interface IReconstructorLens{
|
||||||
|
|
||||||
|
ReconstructorRecipeHandler.LensType getLensType();
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||||
import ellpeck.actuallyadditions.items.tools.*;
|
import ellpeck.actuallyadditions.items.tools.*;
|
||||||
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
||||||
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
||||||
|
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
||||||
import ellpeck.actuallyadditions.util.CompatUtil;
|
import ellpeck.actuallyadditions.util.CompatUtil;
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
@ -129,10 +130,14 @@ public class InitItems{
|
||||||
|
|
||||||
public static Item itemLaserWrench;
|
public static Item itemLaserWrench;
|
||||||
public static Item itemCrystal;
|
public static Item itemCrystal;
|
||||||
|
public static Item itemColorLens;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Items...");
|
ModUtil.LOGGER.info("Initializing Items...");
|
||||||
|
|
||||||
|
itemColorLens = new ItemLens("itemColorLens", ReconstructorRecipeHandler.LensType.COLOR);
|
||||||
|
ItemUtil.register(itemColorLens);
|
||||||
|
|
||||||
itemCrystal = new ItemCrystal();
|
itemCrystal = new ItemCrystal();
|
||||||
ItemUtil.register(itemCrystal);
|
ItemUtil.register(itemCrystal);
|
||||||
|
|
||||||
|
|
61
src/main/java/ellpeck/actuallyadditions/items/ItemLens.java
Normal file
61
src/main/java/ellpeck/actuallyadditions/items/ItemLens.java
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* This file ("ItemLens.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ellpeck.actuallyadditions.items;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
||||||
|
import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
|
||||||
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.item.EnumRarity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
public class ItemLens extends Item implements IActAddItemOrBlock, IReconstructorLens{
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private ReconstructorRecipeHandler.LensType type;
|
||||||
|
|
||||||
|
public ItemLens(String name, ReconstructorRecipeHandler.LensType type){
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
this.setMaxStackSize(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
return EnumRarity.uncommon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerIcons(IIconRegister iconReg){
|
||||||
|
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIcon(ItemStack stack, int pass){
|
||||||
|
return this.itemIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(){
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReconstructorRecipeHandler.LensType getLensType(){
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.particle.EntityReddustFX;
|
import net.minecraft.client.particle.EntityReddustFX;
|
||||||
|
@ -29,19 +30,21 @@ public class PacketAtomicReconstructor implements IMessage{
|
||||||
private int endX;
|
private int endX;
|
||||||
private int endY;
|
private int endY;
|
||||||
private int endZ;
|
private int endZ;
|
||||||
|
private int lensTypeOrdinal;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public PacketAtomicReconstructor(){
|
public PacketAtomicReconstructor(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacketAtomicReconstructor(int startX, int startY, int startZ, int endX, int endY, int endZ){
|
public PacketAtomicReconstructor(int startX, int startY, int startZ, int endX, int endY, int endZ, ReconstructorRecipeHandler.LensType type){
|
||||||
this.startX = startX;
|
this.startX = startX;
|
||||||
this.startY = startY;
|
this.startY = startY;
|
||||||
this.startZ = startZ;
|
this.startZ = startZ;
|
||||||
this.endX = endX;
|
this.endX = endX;
|
||||||
this.endY = endY;
|
this.endY = endY;
|
||||||
this.endZ = endZ;
|
this.endZ = endZ;
|
||||||
|
this.lensTypeOrdinal = type.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,6 +55,7 @@ public class PacketAtomicReconstructor implements IMessage{
|
||||||
this.endX = buf.readInt();
|
this.endX = buf.readInt();
|
||||||
this.endY = buf.readInt();
|
this.endY = buf.readInt();
|
||||||
this.endZ = buf.readInt();
|
this.endZ = buf.readInt();
|
||||||
|
this.lensTypeOrdinal = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,6 +66,7 @@ public class PacketAtomicReconstructor implements IMessage{
|
||||||
buf.writeInt(this.endX);
|
buf.writeInt(this.endX);
|
||||||
buf.writeInt(this.endY);
|
buf.writeInt(this.endY);
|
||||||
buf.writeInt(this.endZ);
|
buf.writeInt(this.endZ);
|
||||||
|
buf.writeInt(this.lensTypeOrdinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Handler implements IMessageHandler<PacketAtomicReconstructor, IMessage>{
|
public static class Handler implements IMessageHandler<PacketAtomicReconstructor, IMessage>{
|
||||||
|
@ -79,7 +84,8 @@ public class PacketAtomicReconstructor implements IMessage{
|
||||||
|
|
||||||
for(int times = 0; times < 5; times++){
|
for(int times = 0; times < 5; times++){
|
||||||
for(double i = 0; i <= 1; i += 1/(distance*8)){
|
for(double i = 0; i <= 1; i += 1/(distance*8)){
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityReddustFX(world, (difX*i)+message.endX+0.5, (difY*i)+message.endY+0.5, (difZ*i)+message.endZ+0.5, 2F, 0, 0, 0));
|
ReconstructorRecipeHandler.LensType type = ReconstructorRecipeHandler.LensType.values()[message.lensTypeOrdinal];
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityReddustFX(world, (difX*i)+message.endX+0.5, (difY*i)+message.endY+0.5, (difZ*i)+message.endZ+0.5, 2F, type.getR(), type.getG(), type.getB()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package ellpeck.actuallyadditions.recipe;
|
package ellpeck.actuallyadditions.recipe;
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
||||||
|
import ellpeck.actuallyadditions.util.Util;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
@ -45,7 +46,11 @@ public class ReconstructorRecipeHandler{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(String input, String output, int energyUse){
|
public static void addRecipe(String input, String output, int energyUse){
|
||||||
recipes.add(new Recipe(input, output, energyUse));
|
addRecipe(input, output, energyUse, LensType.NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addRecipe(String input, String output, int energyUse, LensType type){
|
||||||
|
recipes.add(new Recipe(input, output, energyUse, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Recipe getRecipe(ItemStack input){
|
public static Recipe getRecipe(ItemStack input){
|
||||||
|
@ -65,11 +70,13 @@ public class ReconstructorRecipeHandler{
|
||||||
public String input;
|
public String input;
|
||||||
public String output;
|
public String output;
|
||||||
public int energyUse;
|
public int energyUse;
|
||||||
|
public LensType type;
|
||||||
|
|
||||||
public Recipe(String input, String output, int energyUse){
|
public Recipe(String input, String output, int energyUse, LensType type){
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.energyUse = energyUse;
|
this.energyUse = energyUse;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getFirstOutput(){
|
public ItemStack getFirstOutput(){
|
||||||
|
@ -81,4 +88,31 @@ public class ReconstructorRecipeHandler{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum LensType{
|
||||||
|
|
||||||
|
NONE,
|
||||||
|
COLOR;
|
||||||
|
|
||||||
|
public float getR(){
|
||||||
|
if(this == COLOR){
|
||||||
|
return Util.RANDOM.nextFloat();
|
||||||
|
}
|
||||||
|
return 27F/255F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getG(){
|
||||||
|
if(this == COLOR){
|
||||||
|
return Util.RANDOM.nextFloat();
|
||||||
|
}
|
||||||
|
return 109F/255F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getB(){
|
||||||
|
if(this == COLOR){
|
||||||
|
return Util.RANDOM.nextFloat();
|
||||||
|
}
|
||||||
|
return 1F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||||
|
import ellpeck.actuallyadditions.items.IReconstructorLens;
|
||||||
import ellpeck.actuallyadditions.misc.DamageSources;
|
import ellpeck.actuallyadditions.misc.DamageSources;
|
||||||
import ellpeck.actuallyadditions.network.PacketAtomicReconstructor;
|
import ellpeck.actuallyadditions.network.PacketAtomicReconstructor;
|
||||||
import ellpeck.actuallyadditions.network.PacketHandler;
|
import ellpeck.actuallyadditions.network.PacketHandler;
|
||||||
|
@ -31,12 +32,16 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class TileEntityAtomicReconstructor extends TileEntityBase implements IEnergyReceiver{
|
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||||
|
|
||||||
public EnergyStorage storage = new EnergyStorage(3000000);
|
public EnergyStorage storage = new EnergyStorage(3000000);
|
||||||
|
|
||||||
private int currentTime;
|
private int currentTime;
|
||||||
|
|
||||||
|
public TileEntityAtomicReconstructor(){
|
||||||
|
super(1, "reconstructor");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
|
@ -51,6 +56,8 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
|
||||||
//Extract energy for shooting the laser itself too!
|
//Extract energy for shooting the laser itself too!
|
||||||
this.storage.extractEnergy(baseUse, false);
|
this.storage.extractEnergy(baseUse, false);
|
||||||
|
|
||||||
|
//The Lens the Reconstructor currently has installed
|
||||||
|
ReconstructorRecipeHandler.LensType currentLens = this.getCurrentLens();
|
||||||
int distance = ConfigIntValues.RECONSTRUCTOR_DISTANCE.getValue();
|
int distance = ConfigIntValues.RECONSTRUCTOR_DISTANCE.getValue();
|
||||||
for(int i = 0; i < distance; i++){
|
for(int i = 0; i < distance; i++){
|
||||||
WorldPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
|
WorldPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
|
||||||
|
@ -58,7 +65,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
|
||||||
|
|
||||||
if(coordsBlock != null){
|
if(coordsBlock != null){
|
||||||
if(!coordsBlock.getBlock().isAir(coordsBlock.getWorld(), coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ())){
|
if(!coordsBlock.getBlock().isAir(coordsBlock.getWorld(), coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ())){
|
||||||
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ()), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
|
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ(), currentLens), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
|
||||||
|
|
||||||
int range = ConfigIntValues.RECONSTRCUTOR_RANGE.getValue();
|
int range = ConfigIntValues.RECONSTRCUTOR_RANGE.getValue();
|
||||||
|
|
||||||
|
@ -69,7 +76,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
|
||||||
if(this.storage.getEnergyStored() >= baseUse){
|
if(this.storage.getEnergyStored() >= baseUse){
|
||||||
WorldPos pos = new WorldPos(worldObj, coordsBlock.getX()+reachX, coordsBlock.getY()+reachY, coordsBlock.getZ()+reachZ);
|
WorldPos pos = new WorldPos(worldObj, coordsBlock.getX()+reachX, coordsBlock.getY()+reachY, coordsBlock.getZ()+reachZ);
|
||||||
ReconstructorRecipeHandler.Recipe recipe = ReconstructorRecipeHandler.getRecipe(new ItemStack(pos.getBlock(), 1, pos.getMetadata()));
|
ReconstructorRecipeHandler.Recipe recipe = ReconstructorRecipeHandler.getRecipe(new ItemStack(pos.getBlock(), 1, pos.getMetadata()));
|
||||||
if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse){
|
if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse && recipe.type == currentLens){
|
||||||
ItemStack output = recipe.getFirstOutput();
|
ItemStack output = recipe.getFirstOutput();
|
||||||
if(output != null){
|
if(output != null){
|
||||||
if(output.getItem() instanceof ItemBlock){
|
if(output.getItem() instanceof ItemBlock){
|
||||||
|
@ -95,7 +102,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
|
||||||
ItemStack stack = item.getEntityItem();
|
ItemStack stack = item.getEntityItem();
|
||||||
if(stack != null){
|
if(stack != null){
|
||||||
ReconstructorRecipeHandler.Recipe recipe = ReconstructorRecipeHandler.getRecipe(stack);
|
ReconstructorRecipeHandler.Recipe recipe = ReconstructorRecipeHandler.getRecipe(stack);
|
||||||
if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse){
|
if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse && recipe.type == currentLens){
|
||||||
ItemStack output = recipe.getFirstOutput();
|
ItemStack output = recipe.getFirstOutput();
|
||||||
if(output != null){
|
if(output != null){
|
||||||
ItemStack outputCopy = output.copy();
|
ItemStack outputCopy = output.copy();
|
||||||
|
@ -111,7 +118,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(i >= distance-1){
|
if(i >= distance-1){
|
||||||
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ()), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
|
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ(), currentLens), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,6 +131,15 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReconstructorRecipeHandler.LensType getCurrentLens(){
|
||||||
|
if(this.slots[0] != null){
|
||||||
|
if(this.slots[0].getItem() instanceof IReconstructorLens){
|
||||||
|
return ((IReconstructorLens)this.slots[0].getItem()).getLensType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ReconstructorRecipeHandler.LensType.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void damagePlayer(int x, int y, int z){
|
public void damagePlayer(int x, int y, int z){
|
||||||
ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+1, z+1));
|
ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+1, z+1));
|
||||||
|
@ -165,4 +181,19 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
|
||||||
public boolean canConnectEnergy(ForgeDirection from){
|
public boolean canConnectEnergy(ForgeDirection from){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||||
|
return stack != null && stack.getItem() instanceof IReconstructorLens;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit(){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,12 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class Util{
|
public class Util{
|
||||||
|
|
||||||
|
public static final Random RANDOM = new Random();
|
||||||
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
|
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
|
||||||
|
|
||||||
public static void registerEvent(Object o){
|
public static void registerEvent(Object o){
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 658 B |
Loading…
Reference in a new issue