mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Added MFR Compatibility, fixed Bugs
This commit is contained in:
parent
5863b0a0a4
commit
8051728c71
61 changed files with 2053 additions and 231 deletions
|
@ -16,12 +16,17 @@ import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import powercrystals.minefactoryreloaded.api.FertilizerType;
|
||||||
|
import powercrystals.minefactoryreloaded.api.HarvestType;
|
||||||
|
import powercrystals.minefactoryreloaded.api.IFactoryFertilizable;
|
||||||
|
import powercrystals.minefactoryreloaded.api.IFactoryHarvestable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockPlant extends BlockCrops implements INameableItem{
|
public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHarvestable, IFactoryFertilizable{
|
||||||
|
|
||||||
private IIcon[] textures;
|
private IIcon[] textures;
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -58,7 +63,6 @@ public class BlockPlant extends BlockCrops implements INameableItem{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockOn(Block block){
|
public boolean canPlaceBlockOn(Block block){
|
||||||
return block == ((ItemSeed)this.seedItem).soilBlock;
|
return block == ((ItemSeed)this.seedItem).soilBlock;
|
||||||
|
@ -135,4 +139,57 @@ public class BlockPlant extends BlockCrops implements INameableItem{
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Block getPlant(){
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canFertilize(World world, int x, int y, int z, FertilizerType fertilizerType){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType){
|
||||||
|
if (this.func_149851_a(world, x, y, z, world.isRemote)){
|
||||||
|
if(!world.isRemote){
|
||||||
|
if(this.func_149852_a(world, world.rand, x, y, z)){
|
||||||
|
this.func_149853_b(world, world.rand, x, y, z);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HarvestType getHarvestType(){
|
||||||
|
return HarvestType.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean breakBlock(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBeHarvested(World world, Map<String, Boolean> harvesterSettings, int x, int y, int z){
|
||||||
|
return world.getBlockMetadata(x, y, z) >= 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDrops(World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z){
|
||||||
|
return this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preHarvest(World world, int x, int y, int z){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postHarvest(World world, int x, int y, int z){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import powercrystals.minefactoryreloaded.api.FactoryRegistry;
|
||||||
|
|
||||||
public class InitBlocks{
|
public class InitBlocks{
|
||||||
|
|
||||||
|
@ -76,9 +77,13 @@ public class InitBlocks{
|
||||||
|
|
||||||
blockRice = new BlockPlant("blockRice", 6);
|
blockRice = new BlockPlant("blockRice", 6);
|
||||||
BlockUtil.register(blockRice, BlockPlant.TheItemBlock.class, false);
|
BlockUtil.register(blockRice, BlockPlant.TheItemBlock.class, false);
|
||||||
|
FactoryRegistry.sendMessage("registerHarvestable", blockRice);
|
||||||
|
FactoryRegistry.sendMessage("registerFertilizable", blockRice);
|
||||||
|
|
||||||
blockCanola = new BlockPlant("blockCanola", 4);
|
blockCanola = new BlockPlant("blockCanola", 4);
|
||||||
BlockUtil.register(blockCanola, BlockPlant.TheItemBlock.class, false);
|
BlockUtil.register(blockCanola, BlockPlant.TheItemBlock.class, false);
|
||||||
|
FactoryRegistry.sendMessage("registerHarvestable", blockCanola);
|
||||||
|
FactoryRegistry.sendMessage("registerFertilizable", blockCanola);
|
||||||
|
|
||||||
blockCompost = new BlockCompost();
|
blockCompost = new BlockCompost();
|
||||||
BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class);
|
BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public enum ConfigIntValues{
|
||||||
HEAT_COLLECTOR_BLOCKS("Heat Collector: Blocks Needed", ConfigCategories.MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it"),
|
HEAT_COLLECTOR_BLOCKS("Heat Collector: Blocks Needed", ConfigCategories.MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it"),
|
||||||
HEAT_COLLECTOR_LAVA_CHANCE("Heat Collector: Random Chance", ConfigCategories.MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"),
|
HEAT_COLLECTOR_LAVA_CHANCE("Heat Collector: Random Chance", ConfigCategories.MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"),
|
||||||
|
|
||||||
GLASS_TIME_NEEDED("Greenhouse Glass: Time Needed", ConfigCategories.MACHINE_VALUES, 4000, 10, 1000000, "The Time Needed for the Greenhouse Glass to grow a Plant below it"),
|
GLASS_TIME_NEEDED("Greenhouse Glass: Time", ConfigCategories.MACHINE_VALUES, 5000, 10, 1000000, "The Time Needed for the Greenhouse Glass to grow a Plant below it"),
|
||||||
|
|
||||||
BREAKER_TIME_NEEDED("Breaker and Placer: Time Needed", ConfigCategories.MACHINE_VALUES, 15, 1, 10000, "The Time Needed for the Breaker and the Placer to place or break a Block"),
|
BREAKER_TIME_NEEDED("Breaker and Placer: Time Needed", ConfigCategories.MACHINE_VALUES, 15, 1, 10000, "The Time Needed for the Breaker and the Placer to place or break a Block"),
|
||||||
DROPPER_TIME_NEEDED("Dropper: Time Needed", ConfigCategories.MACHINE_VALUES, 10, 1, 10000, "The Time Needed for the Dropper to drop an Item"),
|
DROPPER_TIME_NEEDED("Dropper: Time Needed", ConfigCategories.MACHINE_VALUES, 10, 1, 10000, "The Time Needed for the Dropper to drop an Item"),
|
||||||
|
@ -61,7 +61,7 @@ public enum ConfigIntValues{
|
||||||
FURNACE_ENERGY_USED("Energy Use: Double Furnace", ConfigCategories.MACHINE_VALUES, 25, 1, 500, "The Amount of Energy used by the Double Furnace per Tick"),
|
FURNACE_ENERGY_USED("Energy Use: Double Furnace", ConfigCategories.MACHINE_VALUES, 25, 1, 500, "The Amount of Energy used by the Double Furnace per Tick"),
|
||||||
|
|
||||||
PRESS_PROCESSING_TIME("Canola Press: Processing Time", ConfigCategories.MACHINE_VALUES, 30, 1, 1000, "The Amount of time it takes to process one Canola"),
|
PRESS_PROCESSING_TIME("Canola Press: Processing Time", ConfigCategories.MACHINE_VALUES, 30, 1, 1000, "The Amount of time it takes to process one Canola"),
|
||||||
PRESS_MB_PRODUCED("Canola Press: mB Produced", ConfigCategories.MACHINE_VALUES, 50, 1, 5000, "The Amount of Canola Oil produced from one Canola"),
|
PRESS_MB_PRODUCED("Canola Press: mB Produced", ConfigCategories.MACHINE_VALUES, 30, 1, 5000, "The Amount of Canola Oil produced from one Canola"),
|
||||||
PRESS_ENERGY_USED("Energy Use: Canola Press", ConfigCategories.MACHINE_VALUES, 35, 10, 500, "The Amount of Energy used by the Canola Press per Tick"),
|
PRESS_ENERGY_USED("Energy Use: Canola Press", ConfigCategories.MACHINE_VALUES, 35, 10, 500, "The Amount of Energy used by the Canola Press per Tick"),
|
||||||
|
|
||||||
BARREL_MB_PRODUCED("Fermenting Barrel: mB Produced", ConfigCategories.MACHINE_VALUES, 50, 1, 3000, "The Amount of mB produced by the Barrel per cycle"),
|
BARREL_MB_PRODUCED("Fermenting Barrel: mB Produced", ConfigCategories.MACHINE_VALUES, 50, 1, 3000, "The Amount of mB produced by the Barrel per cycle"),
|
||||||
|
|
|
@ -50,8 +50,9 @@ public class ContainerBreaker extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
this.mergeItemStack(newStack, 0, 9+1, false);
|
this.mergeItemStack(newStack, 0, 9, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||||
|
@ -73,6 +74,7 @@ public class ContainerBreaker extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -50,8 +50,9 @@ public class ContainerDropper extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
this.mergeItemStack(newStack, 0, 9+1, false);
|
this.mergeItemStack(newStack, 0, 9, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||||
|
@ -73,6 +74,7 @@ public class ContainerDropper extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -79,6 +79,7 @@ public class ContainerFeeder extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
this.mergeItemStack(newStack, 0, 1, false);
|
||||||
}
|
}
|
||||||
|
@ -102,6 +103,7 @@ public class ContainerFeeder extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -93,6 +93,7 @@ public class ContainerFermentingBarrel extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
if(currentStack.getItem() == InitItems.itemBucketCanolaOil){
|
if(currentStack.getItem() == InitItems.itemBucketCanolaOil){
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
this.mergeItemStack(newStack, 0, 1, false);
|
||||||
|
@ -121,6 +122,7 @@ public class ContainerFermentingBarrel extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -96,6 +96,7 @@ public class ContainerFurnaceDouble extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
if(FurnaceRecipes.smelting().getSmeltingResult(currentStack) != null){
|
if(FurnaceRecipes.smelting().getSmeltingResult(currentStack) != null){
|
||||||
this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1+1, false);
|
this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1+1, false);
|
||||||
|
@ -122,6 +123,7 @@ public class ContainerFurnaceDouble extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -50,6 +50,7 @@ public class ContainerGiantChest extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
this.mergeItemStack(newStack, 0, 117, false);
|
this.mergeItemStack(newStack, 0, 117, false);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +74,7 @@ public class ContainerGiantChest extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -102,6 +102,7 @@ public class ContainerGrinder extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
if(GrinderRecipes.instance().getOutput(currentStack, false) != null){
|
if(GrinderRecipes.instance().getOutput(currentStack, false) != null){
|
||||||
this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false);
|
this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false);
|
||||||
|
@ -128,6 +129,7 @@ public class ContainerGrinder extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -114,6 +114,7 @@ public class ContainerInputter extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
this.mergeItemStack(newStack, 0, 1, false);
|
||||||
}
|
}
|
||||||
|
@ -137,6 +138,7 @@ public class ContainerInputter extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -90,6 +90,7 @@ public class ContainerOilGenerator extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
if(currentStack.getItem() == InitItems.itemBucketOil){
|
if(currentStack.getItem() == InitItems.itemBucketOil){
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
this.mergeItemStack(newStack, 0, 1, false);
|
||||||
|
@ -115,6 +116,7 @@ public class ContainerOilGenerator extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -78,6 +78,7 @@ public class ContainerRepairer extends Container{
|
||||||
ItemStack currentStack = theSlot.getStack();
|
ItemStack currentStack = theSlot.getStack();
|
||||||
ItemStack newStack = currentStack.copy();
|
ItemStack newStack = currentStack.copy();
|
||||||
|
|
||||||
|
if(currentStack.getItem() != null){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||||
if(TileEntityItemRepairer.canBeRepaired(currentStack)){
|
if(TileEntityItemRepairer.canBeRepaired(currentStack)){
|
||||||
this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT+1, false);
|
this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT+1, false);
|
||||||
|
@ -103,6 +104,7 @@ public class ContainerRepairer extends Container{
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.EnumPlantType;
|
import net.minecraftforge.common.EnumPlantType;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
|
import powercrystals.minefactoryreloaded.api.FactoryRegistry;
|
||||||
|
|
||||||
public class InitItems{
|
public class InitItems{
|
||||||
|
|
||||||
|
@ -112,9 +113,11 @@ public class InitItems{
|
||||||
|
|
||||||
itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, new ItemStack(itemFoods, 1, TheFoods.RICE.ordinal()));
|
itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, new ItemStack(itemFoods, 1, TheFoods.RICE.ordinal()));
|
||||||
ItemUtil.register(itemRiceSeed);
|
ItemUtil.register(itemRiceSeed);
|
||||||
|
FactoryRegistry.sendMessage("registerPlantable", itemRiceSeed);
|
||||||
|
|
||||||
itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, Blocks.grass, EnumPlantType.Crop, new ItemStack(itemMisc, 1, TheMiscItems.CANOLA.ordinal()));
|
itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, Blocks.grass, EnumPlantType.Plains, new ItemStack(itemMisc, 1, TheMiscItems.CANOLA.ordinal()));
|
||||||
ItemUtil.register(itemCanolaSeed);
|
ItemUtil.register(itemCanolaSeed);
|
||||||
|
FactoryRegistry.sendMessage("registerPlantable", itemCanolaSeed);
|
||||||
|
|
||||||
itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare);
|
itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare);
|
||||||
itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare);
|
itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare);
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ItemPhantomConnector extends Item implements INameableItem{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
||||||
if(KeyUtil.isControlPressed()) this.clearStorage(stack);
|
if(KeyUtil.isAltPressed()) this.clearStorage(stack);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,20 +12,22 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemSeeds;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.EnumPlantType;
|
import net.minecraftforge.common.EnumPlantType;
|
||||||
import net.minecraftforge.common.IPlantable;
|
|
||||||
import net.minecraftforge.common.util.BlockSnapshot;
|
import net.minecraftforge.common.util.BlockSnapshot;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.event.ForgeEventFactory;
|
import net.minecraftforge.event.ForgeEventFactory;
|
||||||
|
import powercrystals.minefactoryreloaded.api.IFactoryPlantable;
|
||||||
|
import powercrystals.minefactoryreloaded.api.ReplacementBlock;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemSeed extends Item implements IPlantable, INameableItem{
|
public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlantable{
|
||||||
|
|
||||||
public Block plant;
|
public Block plant;
|
||||||
public Block soilBlock;
|
public Block soilBlock;
|
||||||
|
@ -33,6 +35,7 @@ public class ItemSeed extends Item implements IPlantable, INameableItem{
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
public ItemSeed(String name, Block plant, Block soilBlock, EnumPlantType type, ItemStack returnItem){
|
public ItemSeed(String name, Block plant, Block soilBlock, EnumPlantType type, ItemStack returnItem){
|
||||||
|
super(plant, soilBlock);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.plant = plant;
|
this.plant = plant;
|
||||||
this.soilBlock = soilBlock;
|
this.soilBlock = soilBlock;
|
||||||
|
@ -64,7 +67,7 @@ public class ItemSeed extends Item implements IPlantable, INameableItem{
|
||||||
int j = pos.blockY;
|
int j = pos.blockY;
|
||||||
int k = pos.blockZ;
|
int k = pos.blockZ;
|
||||||
|
|
||||||
if(world.canMineBlock(player, i, j, k) && player.canPlayerEdit(i, j, k, pos.sideHit, stack)){
|
if(player.canPlayerEdit(i, j, k, pos.sideHit, stack)){
|
||||||
if(world.getBlock(i, j, k).getMaterial() == Material.water && world.getBlockMetadata(i, j, k) == 0 && world.isAirBlock(i, j + 1, k)){
|
if(world.getBlock(i, j, k).getMaterial() == Material.water && world.getBlockMetadata(i, j, k) == 0 && world.isAirBlock(i, j + 1, k)){
|
||||||
BlockSnapshot snap = BlockSnapshot.getBlockSnapshot(world, i, j+1, k);
|
BlockSnapshot snap = BlockSnapshot.getBlockSnapshot(world, i, j+1, k);
|
||||||
world.setBlock(i, j + 1, k, this.plant);
|
world.setBlock(i, j + 1, k, this.plant);
|
||||||
|
@ -127,4 +130,34 @@ public class ItemSeed extends Item implements IPlantable, INameableItem{
|
||||||
public String getOredictName(){
|
public String getOredictName(){
|
||||||
return this.getName();
|
return this.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item getSeed(){
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBePlanted(ItemStack stack, boolean forFermenting){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReplacementBlock getPlantedBlock(World world, int x, int y, int z, ItemStack stack){
|
||||||
|
return new ReplacementBlock(this.plant);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stack){
|
||||||
|
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && ((BlockPlant)this.plant).canPlaceBlockOn(world.getBlock(x, y-1, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prePlant(World world, int x, int y, int z, ItemStack stack){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postPlant(World world, int x, int y, int z, ItemStack stack){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,6 @@ package ellpeck.actuallyadditions.tile;
|
||||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockAir;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
import net.minecraft.util.ChunkCoordinates;
|
||||||
|
@ -70,9 +69,9 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(this.isPlacer && (worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ))){
|
else if(this.isPlacer && worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ)){
|
||||||
ItemStack removeFalse = this.removeFromInventory(false);
|
ItemStack removeFalse = this.removeFromInventory(false);
|
||||||
if(removeFalse != null && Block.getBlockFromItem(removeFalse.getItem()) != blockToBreak && WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, removeFalse)){
|
if(removeFalse != null && WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, removeFalse)){
|
||||||
this.removeFromInventory(true);
|
this.removeFromInventory(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +114,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
|
|
||||||
public ItemStack removeFromInventory(boolean actuallyDo){
|
public ItemStack removeFromInventory(boolean actuallyDo){
|
||||||
for(int i = 0; i < this.slots.length; i++){
|
for(int i = 0; i < this.slots.length; i++){
|
||||||
if(this.slots[i] != null && !(Block.getBlockFromItem(this.slots[i].getItem()) instanceof BlockAir)){
|
if(this.slots[i] != null){
|
||||||
ItemStack slot = this.slots[i].copy();
|
ItemStack slot = this.slots[i].copy();
|
||||||
if(actuallyDo){
|
if(actuallyDo){
|
||||||
this.slots[i].stackSize--;
|
this.slots[i].stackSize--;
|
||||||
|
|
|
@ -80,7 +80,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
||||||
public IInventory getInventory(){
|
public IInventory getInventory(){
|
||||||
TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord);
|
TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord);
|
||||||
if(tile != null && tile instanceof IInventory){
|
if(tile != null && tile instanceof IInventory){
|
||||||
this.markDirty();
|
|
||||||
return (IInventory)tile;
|
return (IInventory)tile;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -113,6 +112,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int i, ItemStack stack){
|
public void setInventorySlotContents(int i, ItemStack stack){
|
||||||
if(this.isBoundTileInRage()) this.getInventory().setInventorySlotContents(i, stack);
|
if(this.isBoundTileInRage()) this.getInventory().setInventorySlotContents(i, stack);
|
||||||
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,13 +2,13 @@ package ellpeck.actuallyadditions.util;
|
||||||
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import ellpeck.actuallyadditions.creative.CreativeTab;
|
import ellpeck.actuallyadditions.creative.CreativeTab;
|
||||||
import ellpeck.actuallyadditions.waila.WailaDataProvider;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockUtil{
|
public class BlockUtil{
|
||||||
|
@ -41,6 +41,8 @@ public class BlockUtil{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final ArrayList<Block> wailaRegisterList = new ArrayList<Block>();
|
||||||
|
|
||||||
public static void register(Block block, Class<? extends ItemBlock> itemBlock, Enum[] list){
|
public static void register(Block block, Class<? extends ItemBlock> itemBlock, Enum[] list){
|
||||||
block.setCreativeTab(CreativeTab.instance);
|
block.setCreativeTab(CreativeTab.instance);
|
||||||
block.setBlockName(createUnlocalizedName(block));
|
block.setBlockName(createUnlocalizedName(block));
|
||||||
|
@ -49,7 +51,7 @@ public class BlockUtil{
|
||||||
if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(block, 1, current.ordinal()));
|
if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(block, 1, current.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
WailaDataProvider.registerList.add(block);
|
wailaRegisterList.add(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(Block block, Class<? extends ItemBlock> itemBlock){
|
public static void register(Block block, Class<? extends ItemBlock> itemBlock){
|
||||||
|
@ -62,7 +64,6 @@ public class BlockUtil{
|
||||||
GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName());
|
GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName());
|
||||||
if(!((INameableItem)block).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)block).getOredictName(), new ItemStack(block, 1, Util.WILDCARD));
|
if(!((INameableItem)block).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)block).getOredictName(), new ItemStack(block, 1, Util.WILDCARD));
|
||||||
|
|
||||||
WailaDataProvider.registerList.add(block);
|
wailaRegisterList.add(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,4 +12,8 @@ public class KeyUtil{
|
||||||
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isAltPressed(){
|
||||||
|
return Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
import net.minecraft.util.ChunkCoordinates;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
|
import net.minecraftforge.common.IPlantable;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
import net.minecraftforge.fluids.FluidTank;
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
import net.minecraftforge.fluids.IFluidHandler;
|
||||||
|
@ -50,8 +51,13 @@ public class WorldUtil{
|
||||||
|
|
||||||
public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
|
public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
|
||||||
if(world instanceof WorldServer){
|
if(world instanceof WorldServer){
|
||||||
|
if(stack.getItem() instanceof IPlantable){
|
||||||
|
if(((IPlantable)stack.getItem()).getPlant(world, x, y, z).canPlaceBlockAt(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ)){
|
||||||
|
return world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, ((IPlantable)stack.getItem()).getPlant(world, x, y, z));
|
||||||
|
}
|
||||||
|
}
|
||||||
if(side != ForgeDirection.UNKNOWN){
|
if(side != ForgeDirection.UNKNOWN){
|
||||||
return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world, x, y, z, side.ordinal(), 0, 0, 0);
|
return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world,x, y, z, side.ordinal(), 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.waila;
|
||||||
import ellpeck.actuallyadditions.blocks.BlockCompost;
|
import ellpeck.actuallyadditions.blocks.BlockCompost;
|
||||||
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityCompost;
|
import ellpeck.actuallyadditions.tile.TileEntityCompost;
|
||||||
|
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||||
import ellpeck.actuallyadditions.util.INameableItem;
|
import ellpeck.actuallyadditions.util.INameableItem;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import ellpeck.actuallyadditions.util.Util;
|
import ellpeck.actuallyadditions.util.Util;
|
||||||
|
@ -18,7 +19,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -26,8 +26,6 @@ public class WailaDataProvider implements IWailaDataProvider{
|
||||||
|
|
||||||
private final String WAILA_PRE_LANG = "gui." + ModUtil.MOD_ID_LOWER + ".waila.";
|
private final String WAILA_PRE_LANG = "gui." + ModUtil.MOD_ID_LOWER + ".waila.";
|
||||||
|
|
||||||
public static final ArrayList<Block> registerList = new ArrayList<Block>();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config){
|
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config){
|
||||||
return null;
|
return null;
|
||||||
|
@ -90,7 +88,7 @@ public class WailaDataProvider implements IWailaDataProvider{
|
||||||
|
|
||||||
registrar.registerBodyProvider(provider, BlockCompost.class);
|
registrar.registerBodyProvider(provider, BlockCompost.class);
|
||||||
|
|
||||||
for(Block theBlock : registerList){
|
for(Block theBlock : BlockUtil.wailaRegisterList){
|
||||||
registrar.registerHeadProvider(provider, theBlock.getClass());
|
registrar.registerHeadProvider(provider, theBlock.getClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PowerCrystals
|
||||||
|
*
|
||||||
|
* Class used to register plants and other farming-related things with MFR. Will do nothing if MFR does not exist.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class FactoryRegistry
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* This may be called at any time during pre-init, init or post-init, assuming all blocks and items
|
||||||
|
* that are being accessed from the registry have been appropriately registered.
|
||||||
|
* Possible messages:
|
||||||
|
*
|
||||||
|
* // Registration:
|
||||||
|
* addLaserPreferredOre | NBTTag with an ItemStack saved on it, with the color on the "value" attribute,
|
||||||
|
* | A ValuedItem with item and value set.
|
||||||
|
* registerAutoSpawnerBlacklist | The String identifier of an entity,
|
||||||
|
* | A subclass of EntityLivingBase.
|
||||||
|
* registerFertilizable | An instance of IFactoryFertilizable.
|
||||||
|
* registerFertilizer | An instance of IFactoryFertilizer.
|
||||||
|
* registerFruitLog | The String identifier of a block.
|
||||||
|
* registerGrindable | An instance of IFactoryGrindable.
|
||||||
|
* registerGrinderBlacklist | A subclass of EntityLivingBase.
|
||||||
|
* registerHarvestable | An instance of IFactoryHarvestable.
|
||||||
|
* registerLaserOre | NBTTag with an ItemStack saved on it, with the weight on the "value" attribute,
|
||||||
|
* | A ValuedItem with item and value set.
|
||||||
|
* registerLiquidDrinkHandler | A ValuedItem with key and object set; ILiquidDrinkHandler expected.
|
||||||
|
* registerMobEggHandler | An instance of IMobEggHandler.
|
||||||
|
* registerPickableFruit | An instance of IFactoryFruit.
|
||||||
|
* registerPlantable | An instance of IFactoryPlantable.
|
||||||
|
* registerRanchable | An instance of IFactoryRanchable.
|
||||||
|
* registerRedNetLogicCircuit | An instance of IRedNetLogicCircuit.
|
||||||
|
* registerRubberTreeBiome | The biomeName field of a biome to white list for rubber trees to spawn in.
|
||||||
|
* registerSafariNetBlacklist | A subclass of EntityLivingBase.
|
||||||
|
* registerSafariNetHandler | An instance of ISafariNetHandler.
|
||||||
|
* registerSludgeDrop | NBTTag with an ItemStack saved on it, with the weight on the "value" attribute,
|
||||||
|
* | A ValuedItem with item and value set.
|
||||||
|
* registerSpawnHandler | An instance of IMobSpawnHandler.
|
||||||
|
* registerVillagerTradeMob | An instance of IRandomMobProvider.
|
||||||
|
*
|
||||||
|
* // Simple implementations:
|
||||||
|
* { Harvestables
|
||||||
|
* registerHarvestable_Standard | The String identifier of a block.
|
||||||
|
* registerHarvestable_Log | The String identifier of a block.
|
||||||
|
* registerHarvestable_Leaves | The String identifier of a block.
|
||||||
|
* registerHarvestable_Vine | The String identifier of a block.
|
||||||
|
* registerHarvestable_Shrub | The String identifier of a block.
|
||||||
|
* registerHarvestable_Mushroom | The String identifier of a block.
|
||||||
|
* registerHarvestable_Crop | An ItemStack of a block, with a damage value indicating the meta value to harvest at.
|
||||||
|
* | A ValuedItem with value and object set; Block expected.
|
||||||
|
* registerHarvestable_Gourd | An NBTTag with the stem and fruit attributes, both String identifiers of blocks.
|
||||||
|
* }
|
||||||
|
* { Plantables
|
||||||
|
* registerPlantable_Standard | An NBTTag with the seed (Item, String identifier), and
|
||||||
|
* crop (Block, String identifier) attributes set, optionally
|
||||||
|
* also having the meta (Integer, accepted metadata value of the seed item) attribute set.
|
||||||
|
* No special checks for location, just sustainability.
|
||||||
|
* registerPlantable_Crop | An NBTTag with the seed (Item, String identifier), and
|
||||||
|
* crop (Block, String identifier) attributes set, optionally
|
||||||
|
* also having the meta (Integer, accepted metadata value of the seed item) attribute set.
|
||||||
|
* Will automatically hoe dirt and grass into farmland when planting.
|
||||||
|
* registerPlantable_Sapling | An NBTTag with the sapling (Block, String identifier), and optionally
|
||||||
|
* the seed (Item, String identifier) attributes set.
|
||||||
|
* }
|
||||||
|
* { Fertilizer
|
||||||
|
* registerFertilizer_Standard | An NBTTag with the fert (Item, String identifier), meta (Integer), and
|
||||||
|
* type (Integer, index into FertilizerType.values()) attributes set.
|
||||||
|
* }
|
||||||
|
* { Fertilizables
|
||||||
|
* registerFertilizable_Grass | The String identifier of a block. Will bonemeal the block and expect
|
||||||
|
* tall grass be planted above and around it, must be IGrowable. Works with
|
||||||
|
* the GrowPlant and Grass type fertilizers, not recommended for crop plants.
|
||||||
|
* registerFertilizable_Gourd | The String identifier of a block. Must be IGrowable, and expects identical
|
||||||
|
* behavior to vanilla stems. Works with the GrowPlant fertilizers.
|
||||||
|
* registerFertilizable_Crop | An NBTTag with the plant (Block, String identifier, IGrowable), and
|
||||||
|
* meta (Integer, max growth phase) attributes set, optionally also having
|
||||||
|
* the type (Integer, index into FertilizerType) attribute set.
|
||||||
|
* registerFertilizable_Cocoa | An NBTTag with the plant (Block, String identifier), and optionally also
|
||||||
|
* the type (Integer, index into FertilizerType) attributes set.
|
||||||
|
* Expects metadata of the block to exactly match cocoa pods.
|
||||||
|
* registerFertilizable_Standard | An NBTTag with the plant (Block, String identifier, IGrowable), and
|
||||||
|
* optionally also the type (Integer, index into FertilizerType) attributes set.
|
||||||
|
* Expects the block to change when successfully grown (e.g., saplings).
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public static void sendMessage(String message, Object value)
|
||||||
|
{
|
||||||
|
if (!Loader.isModLoaded("MineFactoryReloaded") ||
|
||||||
|
Loader.instance().activeModContainer() == null)
|
||||||
|
return;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Method m = FMLInterModComms.class.getDeclaredMethod("enqueueMessage", Object.class, String.class, IMCMessage.class);
|
||||||
|
m.setAccessible(true);
|
||||||
|
Constructor<IMCMessage> c = IMCMessage.class.getDeclaredConstructor(String.class, Object.class);
|
||||||
|
c.setAccessible(true);
|
||||||
|
m.invoke(null, Loader.instance().activeModContainer(), "MineFactoryReloaded", c.newInstance(message, value));
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines what kind of action a given fertilizer can perform. Your
|
||||||
|
* IFactoryFertilizable instances should check this before performing any action
|
||||||
|
* to maintain future compatibility.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public enum FertilizerType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fertilizer will fertilize nothing.
|
||||||
|
*/
|
||||||
|
None,
|
||||||
|
/**
|
||||||
|
* The fertilizer will fertilize grass.
|
||||||
|
*/
|
||||||
|
Grass,
|
||||||
|
/**
|
||||||
|
* The fertilizer will grow a plant.
|
||||||
|
*/
|
||||||
|
GrowPlant,
|
||||||
|
/**
|
||||||
|
* The fertilizer will grow magical crops.
|
||||||
|
*/
|
||||||
|
GrowMagicalCrop,
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines what algorithm the Harvester uses when it encounters this
|
||||||
|
* IFactoryHarvestable in the world.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public enum HarvestType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Just break the single block - no special action needed. e.g. Carrots,
|
||||||
|
* flowers, wheat.
|
||||||
|
*/
|
||||||
|
Normal,
|
||||||
|
/**
|
||||||
|
* Search for harvestable blocks adjacent to this block but leave this
|
||||||
|
* block. e.g. Pumpkin, melon
|
||||||
|
*/
|
||||||
|
Gourd,
|
||||||
|
/**
|
||||||
|
* Search for identical blocks above.
|
||||||
|
*/
|
||||||
|
Column,
|
||||||
|
/**
|
||||||
|
* Search for identical blocks above but leave the bottom one for the
|
||||||
|
* future. e.g. Cactus, sugarcane.
|
||||||
|
*/
|
||||||
|
LeaveBottom,
|
||||||
|
/**
|
||||||
|
* This block is the base of a tree and the harvester should enter
|
||||||
|
* tree-cutting mode.
|
||||||
|
*/
|
||||||
|
Tree,
|
||||||
|
/**
|
||||||
|
* This block is the base of the tree and the harvester should enter
|
||||||
|
* tree-cutting mode.
|
||||||
|
* The tree is searched for in the negative y axis instead.
|
||||||
|
*/
|
||||||
|
TreeFlipped,
|
||||||
|
/**
|
||||||
|
* This block is part of a tree as above, but leaves are cut before logs.
|
||||||
|
* The tree is searched for in the current mode.
|
||||||
|
* <p>
|
||||||
|
* If not in tree-cutting mode, tree-cutting mode will be entered as though
|
||||||
|
* the type was Tree.
|
||||||
|
*/
|
||||||
|
TreeLeaf,
|
||||||
|
/**
|
||||||
|
* This block is part of a tree as above, but fruits are cut before logs.
|
||||||
|
* e.g. cocoa
|
||||||
|
* The tree is not searched for.
|
||||||
|
*/
|
||||||
|
TreeFruit
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public interface IDeepStorageUnit {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return A populated ItemStack with stackSize for the full amount of
|
||||||
|
* materials in the DSU. <br>
|
||||||
|
* May have a stackSize > getMaxStackSize(). May have a stackSize of
|
||||||
|
* 0 (indicating locked contents).
|
||||||
|
*/
|
||||||
|
ItemStack getStoredItemType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the total amount of the item currently being stored, or zero if all
|
||||||
|
* items are to be removed.
|
||||||
|
*/
|
||||||
|
void setStoredItemCount(int amount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the type of the stored item and initializes the number of stored
|
||||||
|
* items to amount.
|
||||||
|
* <p>
|
||||||
|
* Will overwrite any existing stored items.
|
||||||
|
*/
|
||||||
|
void setStoredItemType(ItemStack type, int amount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The maximum number of items the DSU can hold. <br>
|
||||||
|
* May change based on the current type stored.
|
||||||
|
*/
|
||||||
|
int getMaxStoredCount();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a fertilizable block, and the process to fertilize it. You can assume
|
||||||
|
* that you will never have to check that block matches the one returned by
|
||||||
|
* getPlant().
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface IFactoryFertilizable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The block this instance is managing.
|
||||||
|
*/
|
||||||
|
public Block getPlant();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world
|
||||||
|
* The world this block belongs to.
|
||||||
|
* @param x
|
||||||
|
* The X coordinate of this block.
|
||||||
|
* @param y
|
||||||
|
* The Y coordinate of this block.
|
||||||
|
* @param z
|
||||||
|
* The Z coordinate of this block.
|
||||||
|
* @param fertilizerType
|
||||||
|
* The kind of fertilizer being used.
|
||||||
|
*
|
||||||
|
* @return True if the block at (x,y,z) can be fertilized with the given
|
||||||
|
* type of fertilizer.
|
||||||
|
*/
|
||||||
|
public boolean canFertilize(World world, int x, int y, int z, FertilizerType fertilizerType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world
|
||||||
|
* The world this block belongs to.
|
||||||
|
* @param rand
|
||||||
|
* A Random instance to use when fertilizing, if necessary.
|
||||||
|
* @param x
|
||||||
|
* The X coordinate of this block.
|
||||||
|
* @param y
|
||||||
|
* The Y coordinate of this block.
|
||||||
|
* @param z
|
||||||
|
* The Z coordinate of this block.
|
||||||
|
* @param fertilizerType
|
||||||
|
* The kind of fertilizer being used.
|
||||||
|
*
|
||||||
|
* @return True if fertilization was successful. If false, the Fertilizer
|
||||||
|
* will not consume a fertilizer item and will not drain power.
|
||||||
|
*/
|
||||||
|
public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a fertilizer item for use in the Fertilizer.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface IFactoryFertilizer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The ID of this fertilizer item.
|
||||||
|
*/
|
||||||
|
Item getFertilizer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The type of fertilizer this is.
|
||||||
|
*/
|
||||||
|
FertilizerType getFertilizerType(ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a fertilization is successful. If you set the ItemStack size
|
||||||
|
* to 0, it will be deleted by the fertilizer.
|
||||||
|
*
|
||||||
|
* @param fertilizer
|
||||||
|
* The ItemStack used to fertilize.
|
||||||
|
*/
|
||||||
|
void consume(ItemStack fertilizer);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a fruit entry for the Fruit Picker.
|
||||||
|
*
|
||||||
|
* @author powercrystals
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IFactoryFruit {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The block this fruit has in the world.
|
||||||
|
*/
|
||||||
|
public Block getPlant();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to determine if this fruit can be picked (is it ripe yet, etc)
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world where the fruit is being picked
|
||||||
|
* @param x
|
||||||
|
* The x-coordinate of the fruit
|
||||||
|
* @param y
|
||||||
|
* The y-coordinate of the fruit
|
||||||
|
* @param z
|
||||||
|
* The z-coordinate of the fruit
|
||||||
|
*
|
||||||
|
* @return True if the fruit can be picked
|
||||||
|
*/
|
||||||
|
public boolean canBePicked(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This method is no longer called. ReplacementBlock now handles
|
||||||
|
* interaction.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public boolean breakBlock();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the Fruit Picker to determine what block to replace the picked
|
||||||
|
* block with. At the time this method is called, the fruit still exists.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world where the fruit is being picked
|
||||||
|
* @param x
|
||||||
|
* The x-coordinate of the fruit
|
||||||
|
* @param y
|
||||||
|
* The y-coordinate of the fruit
|
||||||
|
* @param z
|
||||||
|
* The z-coordinate of the fruit
|
||||||
|
*
|
||||||
|
* @return The block to replace the fruit block with, or null for air.
|
||||||
|
*/
|
||||||
|
public ReplacementBlock getReplacementBlock(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the Fruit Picker to determine what drops to generate. At the
|
||||||
|
* time this method is called, the fruit still exists.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world where the fruit is being picked
|
||||||
|
* @param x
|
||||||
|
* The x-coordinate of the fruit
|
||||||
|
* @param y
|
||||||
|
* The y-coordinate of the fruit
|
||||||
|
* @param z
|
||||||
|
* The z-coordinate of the fruit
|
||||||
|
*/
|
||||||
|
public List<ItemStack> getDrops(World world, Random rand, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the Fruit Picker after getDrops, prior to the block being
|
||||||
|
* replaced/removed.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world where the fruit is being picked
|
||||||
|
* @param x
|
||||||
|
* The x-coordinate of the fruit
|
||||||
|
* @param y
|
||||||
|
* The y-coordinate of the fruit
|
||||||
|
* @param z
|
||||||
|
* The z-coordinate of the fruit
|
||||||
|
*/
|
||||||
|
public void prePick(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the Fruit Picker after the fruit is picked.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world where the fruit is being picked
|
||||||
|
* @param x
|
||||||
|
* The x-coordinate of the fruit
|
||||||
|
* @param y
|
||||||
|
* The y-coordinate of the fruit
|
||||||
|
* @param z
|
||||||
|
* The z-coordinate of the fruit
|
||||||
|
*/
|
||||||
|
public void postPick(World world, int x, int y, int z);
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a grindable entity for the Grinder.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface IFactoryGrindable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The class that this grindable instance is handling. This must be
|
||||||
|
* a subtype of EntityLivingBase or the entity will never
|
||||||
|
* be noticed by the Grinder.
|
||||||
|
*/
|
||||||
|
public Class<? extends EntityLivingBase> getGrindableEntity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world
|
||||||
|
* The world this entity is in.
|
||||||
|
* @param entity
|
||||||
|
* The entity instance being ground.
|
||||||
|
* @param random
|
||||||
|
* A Random instance.
|
||||||
|
*
|
||||||
|
* @return The drops generated when this entity is killed. Only one of these
|
||||||
|
* will be chosen.
|
||||||
|
*/
|
||||||
|
public List<MobDrop> grind(World world, EntityLivingBase entity, Random random);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param entity
|
||||||
|
* The entity instance being ground.
|
||||||
|
*
|
||||||
|
* @return Whether this entity has been fully processed or not. (e.g., it is
|
||||||
|
* already dead)
|
||||||
|
*/
|
||||||
|
public boolean processEntity(EntityLivingBase entity);
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a harvestable block for the Harvester.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface IFactoryHarvestable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The block this harvestable instance is managing.
|
||||||
|
*/
|
||||||
|
public Block getPlant();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The type of harvest the Harvester should perform on this block.
|
||||||
|
*/
|
||||||
|
public HarvestType getHarvestType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to determine if the harvester should replace this block with air.
|
||||||
|
*
|
||||||
|
* @return Whether or not the Harvester should break the block when
|
||||||
|
* harvesting. If false, no changes will be performed by the
|
||||||
|
* Harvester itself.
|
||||||
|
*/
|
||||||
|
public boolean breakBlock();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to determine if this crop can be harvested (is it at a stage that
|
||||||
|
* drops crops, etc.)
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world this block is in.
|
||||||
|
* @param harvesterSettings
|
||||||
|
* The harvester's current settings. Do not modify these.
|
||||||
|
* @param x
|
||||||
|
* The X coordinate of the block being harvested.
|
||||||
|
* @param y
|
||||||
|
* The Y coordinate of the block being harvested.
|
||||||
|
* @param z
|
||||||
|
* The Z coordinate of the block being harvested.
|
||||||
|
*
|
||||||
|
* @return True if this block can be harvested.
|
||||||
|
*/
|
||||||
|
public boolean canBeHarvested(World world, Map<String, Boolean> harvesterSettings, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world
|
||||||
|
* The world this block is in.
|
||||||
|
* @param rand
|
||||||
|
* A Random instance to use when generating drops.
|
||||||
|
* @param harvesterSettings
|
||||||
|
* The harvester's current settings. Do not modify these.
|
||||||
|
* @param x
|
||||||
|
* The X coordinate of the block being harvested.
|
||||||
|
* @param y
|
||||||
|
* The Y coordinate of the block being harvested.
|
||||||
|
* @param z
|
||||||
|
* The Z coordinate of the block being harvested.
|
||||||
|
*
|
||||||
|
* @return The drops generated by breaking this block. For a default
|
||||||
|
* implementation, calling Block.getDrops() is usually
|
||||||
|
* sufficient.
|
||||||
|
*/
|
||||||
|
public List<ItemStack> getDrops(World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before the block is going to be harvested, after getDrops. Usually
|
||||||
|
* empty.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world this block is in.
|
||||||
|
* @param x
|
||||||
|
* The X coordinate of the block being harvested.
|
||||||
|
* @param y
|
||||||
|
* The Y coordinate of the block being harvested.
|
||||||
|
* @param z
|
||||||
|
* The Z coordinate of the block being harvested.
|
||||||
|
*/
|
||||||
|
public void preHarvest(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after the block is going to be harvested. Used to re-till soil,
|
||||||
|
* for example.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world this block is in.
|
||||||
|
* @param x
|
||||||
|
* The X coordinate of the block being harvested.
|
||||||
|
* @param y
|
||||||
|
* The Y coordinate of the block being harvested.
|
||||||
|
* @param z
|
||||||
|
* The Z coordinate of the block being harvested.
|
||||||
|
*/
|
||||||
|
public void postHarvest(World world, int x, int y, int z);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a target for the laser blocks. TileEntities that implement this
|
||||||
|
* interface will sustain the beam.
|
||||||
|
*
|
||||||
|
* @author skyboy
|
||||||
|
*/
|
||||||
|
public interface IFactoryLaserSource {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to determine if laser blocks can remain in the world when emitted
|
||||||
|
* from <tt>from</tt>
|
||||||
|
*
|
||||||
|
* @param from
|
||||||
|
* The direction the laser is oriented
|
||||||
|
*
|
||||||
|
* @return True if the beam should be sustained from this side
|
||||||
|
*/
|
||||||
|
public boolean canFormBeamFrom(ForgeDirection from);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a target for the Laser Drill Precharger
|
||||||
|
*
|
||||||
|
* @author skyboy
|
||||||
|
*/
|
||||||
|
public interface IFactoryLaserTarget {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to be determined if a laser can be formed on <tt>from</tt>
|
||||||
|
*
|
||||||
|
* @param from
|
||||||
|
* The direction the laser is coming from
|
||||||
|
*
|
||||||
|
* @return True if the precharger can form a beam from this side
|
||||||
|
*/
|
||||||
|
public boolean canFormBeamWith(ForgeDirection from);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to add energy to the tile.
|
||||||
|
*
|
||||||
|
* @param from
|
||||||
|
* The direction the energy is coming from
|
||||||
|
* @param energy
|
||||||
|
* The amount of energy being transferred
|
||||||
|
* @param simulate
|
||||||
|
* true if this transaction will only be simulated
|
||||||
|
*
|
||||||
|
* @return The amount of energy not consumed
|
||||||
|
*/
|
||||||
|
public int addEnergy(ForgeDirection from, int energy, boolean simulate);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a plantable object for use in the Planter.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface IFactoryPlantable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The item this plantable is managing.
|
||||||
|
*/
|
||||||
|
public Item getSeed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param stack
|
||||||
|
* The stack being planted.
|
||||||
|
* @param forFermenting
|
||||||
|
* True if this stack will be converted to biofuel
|
||||||
|
*
|
||||||
|
* @return True if this plantable can be planted (useful for metadata
|
||||||
|
* items).
|
||||||
|
*/
|
||||||
|
public boolean canBePlanted(ItemStack stack, boolean forFermenting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world
|
||||||
|
* The world instance this block or item will be placed into.
|
||||||
|
* @param x
|
||||||
|
* The destination X coordinate.
|
||||||
|
* @param y
|
||||||
|
* The destination Y coordinate.
|
||||||
|
* @param z
|
||||||
|
* The destination Z coordinate.
|
||||||
|
* @param stack
|
||||||
|
* The stack being planted.
|
||||||
|
*
|
||||||
|
* @return The block that will be placed into the world.
|
||||||
|
*/
|
||||||
|
public ReplacementBlock getPlantedBlock(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world
|
||||||
|
* The world instance this block or item will be placed into.
|
||||||
|
* @param x
|
||||||
|
* The destination X coordinate.
|
||||||
|
* @param y
|
||||||
|
* The destination Y coordinate.
|
||||||
|
* @param z
|
||||||
|
* The destination Z coordinate.
|
||||||
|
* @param stack
|
||||||
|
* The stack being planted.
|
||||||
|
*
|
||||||
|
* @return True if this plantable can be placed at the provided coordinates.
|
||||||
|
*/
|
||||||
|
public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before planting is performed. Used to till soil, for example.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world instance this block or item will be placed into.
|
||||||
|
* @param x
|
||||||
|
* The destination X coordinate.
|
||||||
|
* @param y
|
||||||
|
* The destination Y coordinate.
|
||||||
|
* @param z
|
||||||
|
* The destination Z coordinate.
|
||||||
|
* @param stack
|
||||||
|
* The stack being planted.
|
||||||
|
*/
|
||||||
|
public void prePlant(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after planting is performed. Usually empty.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world instance this block or item will be placed into.
|
||||||
|
* @param x
|
||||||
|
* The destination X coordinate.
|
||||||
|
* @param y
|
||||||
|
* The destination Y coordinate.
|
||||||
|
* @param z
|
||||||
|
* The destination Z coordinate.
|
||||||
|
* @param stack
|
||||||
|
* The stack being planted.
|
||||||
|
*/
|
||||||
|
public void postPlant(World world, int x, int y, int z, ItemStack stack);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a ranchable entity for use in the Rancher.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface IFactoryRanchable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The entity being ranched. Must be a subtype of EntityLivingBase.
|
||||||
|
*/
|
||||||
|
public Class<? extends EntityLivingBase> getRanchableEntity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world
|
||||||
|
* The world this entity is in.
|
||||||
|
* @param entity
|
||||||
|
* The entity instance being ranched.
|
||||||
|
* @param rancher
|
||||||
|
* The rancher instance doing the ranching. Used to access the
|
||||||
|
* Rancher's inventory when milking cows, for example.
|
||||||
|
*
|
||||||
|
* @return A list of drops. All Items be dropped, fluids not matching the tank's contents will be discarded.
|
||||||
|
*/
|
||||||
|
public List<RanchedItem> ranch(World world, EntityLivingBase entity, IInventory rancher);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
|
||||||
|
public interface ILiquidDrinkHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an entity has consumed the fluid this manages.
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
* The entity that has consumed the fluid this
|
||||||
|
* ILiquidDrinkHandler manages
|
||||||
|
*/
|
||||||
|
public void onDrink(EntityLivingBase entity);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a tool that can rotate MFR machines. Implement on an Item class.
|
||||||
|
* Requires no additional work on your part.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface IMFRHammer {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityList.EntityEggInfo;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a class that MFR will use to local egg info for a given mob. This is
|
||||||
|
* used to color the Safari Net based on the captured mob.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface IMobEggHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param safariNet
|
||||||
|
* The Safari Net that is looking for egg info.
|
||||||
|
*
|
||||||
|
* @return An EntityEggInfo, or null if this instance cannot handle this
|
||||||
|
* mob.
|
||||||
|
*/
|
||||||
|
public EntityEggInfo getEgg(ItemStack safariNet);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a handler for mob spawns from the autospawner. Added primarily to
|
||||||
|
* solve item duping on exact spawn & entity inventories
|
||||||
|
*
|
||||||
|
* @author skyboy
|
||||||
|
*/
|
||||||
|
public interface IMobSpawnHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The class that this instance is handling.
|
||||||
|
*/
|
||||||
|
public Class<? extends EntityLivingBase> getMobClass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a mob has been spawned normally.
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
* The entity instance being spawned. Typically your regular
|
||||||
|
* spawn code 100% handles this
|
||||||
|
*/
|
||||||
|
public void onMobSpawn(EntityLivingBase entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an exact copy of an entity has been made.
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
* The entity instance being exact-copied. Clear your inventories
|
||||||
|
* & etc. here
|
||||||
|
*/
|
||||||
|
public void onMobExactSpawn(EntityLivingBase entity);
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public interface INeedleAmmo {
|
||||||
|
|
||||||
|
public boolean onHitEntity(ItemStack stac, EntityPlayer owner, Entity hit, double distance);
|
||||||
|
|
||||||
|
public void onHitBlock(ItemStack stac, EntityPlayer owner, World world, int x, int y, int z, int side, double distance);
|
||||||
|
|
||||||
|
public float getSpread(ItemStack stack);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IRandomMobProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to provide random entities to be spawned by mystery SafariNets
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world object the entities will be spawned in.
|
||||||
|
* @return A list of RandomMob instances of entities that are all ready to
|
||||||
|
* be spawned in the world with no additional method calls.
|
||||||
|
*/
|
||||||
|
public List<RandomMob> getRandomMobs(World world);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines an object that can display information about a captured mob in a
|
||||||
|
* Safari net.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface ISafariNetHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The class of mob that this handler applies to.
|
||||||
|
*/
|
||||||
|
public Class<?> validFor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to add information regarding a mob contained in a SafariNet.
|
||||||
|
*
|
||||||
|
* @param safariNetStack
|
||||||
|
* The Safari Net that is requesting information.
|
||||||
|
* @param player
|
||||||
|
* The player holding the Safari Net.
|
||||||
|
* @param infoList
|
||||||
|
* The current list of information strings. Add yours to this.
|
||||||
|
* @param advancedTooltips
|
||||||
|
* True if the advanced tooltips option is on.
|
||||||
|
*/
|
||||||
|
public void addInformation(ItemStack safariNetStack, EntityPlayer player, List<String> infoList, boolean advancedTooltips);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a syringe for use in the Vet machine.
|
||||||
|
*
|
||||||
|
* @author PowerCrystals
|
||||||
|
*/
|
||||||
|
public interface ISyringe {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the vet is deciding if it should use this syringe.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world instance.
|
||||||
|
* @param entity
|
||||||
|
* The entity being injected.
|
||||||
|
* @param syringe
|
||||||
|
* The syringe ItemStack.
|
||||||
|
*
|
||||||
|
* @return True if the entity can be injected by this syringe.
|
||||||
|
*/
|
||||||
|
public boolean canInject(World world, EntityLivingBase entity, ItemStack syringe);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to perform an injection.
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* The world instance.
|
||||||
|
* @param entity
|
||||||
|
* The entity being injected.
|
||||||
|
* @param syringe
|
||||||
|
* The syringe ItemStack.
|
||||||
|
*
|
||||||
|
* @return True if injection was successful.
|
||||||
|
*/
|
||||||
|
public boolean inject(World world, EntityLivingBase entity, ItemStack syringe);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to check if a syringe is empty
|
||||||
|
*
|
||||||
|
* @param syringe
|
||||||
|
* The syringe ItemStack.
|
||||||
|
*
|
||||||
|
* @return True if the syringe is empty
|
||||||
|
*/
|
||||||
|
public boolean isEmpty(ItemStack syringe);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to get the empty syringe
|
||||||
|
* <p>
|
||||||
|
* <b>Note</b>: this will replace the syringe, max stacksize should be 1
|
||||||
|
*
|
||||||
|
* @param syringe
|
||||||
|
* The syringe ItemStack.
|
||||||
|
*
|
||||||
|
* @return An empty syringe ItemStack
|
||||||
|
*/
|
||||||
|
public ItemStack getEmptySyringe(ItemStack syringe);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.WeightedRandom;
|
||||||
|
|
||||||
|
public class MobDrop extends WeightedRandom.Item
|
||||||
|
{
|
||||||
|
private ItemStack _stack;
|
||||||
|
|
||||||
|
public MobDrop(int weight, ItemStack stack)
|
||||||
|
{
|
||||||
|
super(weight);
|
||||||
|
_stack = stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack()
|
||||||
|
{
|
||||||
|
if(_stack == null) return null;
|
||||||
|
return _stack.copy();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author skyboy026
|
||||||
|
*
|
||||||
|
* Defines an ItemStack or a FluidStack that is the result of an entity being ranched
|
||||||
|
*/
|
||||||
|
public final class RanchedItem {
|
||||||
|
private final ItemStack item;
|
||||||
|
private final FluidStack fluid;
|
||||||
|
|
||||||
|
public RanchedItem(Block item, int amount, int meta)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item, amount, meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Block item, int amount)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item, amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Block item)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Item item, int amount, int meta)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item, amount, meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Item item, int amount)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item, amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(Item item)
|
||||||
|
{
|
||||||
|
this(new ItemStack(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(ItemStack item)
|
||||||
|
{
|
||||||
|
this.item = item;
|
||||||
|
fluid = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RanchedItem(FluidStack fluid)
|
||||||
|
{
|
||||||
|
this.fluid = fluid;
|
||||||
|
item = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasFluid()
|
||||||
|
{
|
||||||
|
return item == null & fluid != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getResult()
|
||||||
|
{
|
||||||
|
return item == null ? fluid : item;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.WeightedRandom;
|
||||||
|
|
||||||
|
public class RandomMob extends WeightedRandom.Item
|
||||||
|
{
|
||||||
|
private Entity _mob;
|
||||||
|
public final boolean shouldInit;
|
||||||
|
|
||||||
|
public RandomMob(Entity savedMob, int weight, boolean init)
|
||||||
|
{
|
||||||
|
super(weight);
|
||||||
|
_mob = savedMob;
|
||||||
|
shouldInit = init;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RandomMob(Entity savedMob, int weight)
|
||||||
|
{
|
||||||
|
this(savedMob, weight, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getMob()
|
||||||
|
{
|
||||||
|
if(_mob == null) return null;
|
||||||
|
return _mob;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class ReplacementBlock
|
||||||
|
{
|
||||||
|
protected byte _hasMeta;
|
||||||
|
protected int _meta;
|
||||||
|
protected final Block _block;
|
||||||
|
protected final NBTTagCompound _tileTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to replace a block in the world.
|
||||||
|
* @param world The world object
|
||||||
|
* @param x The X coord
|
||||||
|
* @param y The Y coord
|
||||||
|
* @param z The Z coord
|
||||||
|
* @param stack The ItemStack being used to replace the block (may be null)
|
||||||
|
* @return True if the block was set successfully
|
||||||
|
*/
|
||||||
|
public boolean replaceBlock(World world, int x, int y, int z, ItemStack stack)
|
||||||
|
{
|
||||||
|
int meta = getMeta(world, x, y, z, stack);
|
||||||
|
if (world.setBlock(x, y, z, _block, meta, 3))
|
||||||
|
{
|
||||||
|
if (hasTag(stack) && _block.hasTileEntity(meta))
|
||||||
|
{
|
||||||
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
if (tile != null)
|
||||||
|
tile.readFromNBT(getTag(world, x, y, z, stack));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to get the metadata of the replacement block in the world.
|
||||||
|
* @param world The world object
|
||||||
|
* @param x The X coord
|
||||||
|
* @param y The Y coord
|
||||||
|
* @param z The Z coord
|
||||||
|
* @param stack The ItemStack being used to replace the block (may be null)
|
||||||
|
* @return The metadata of the block
|
||||||
|
*/
|
||||||
|
protected int getMeta(World world, int x, int y, int z, ItemStack stack)
|
||||||
|
{
|
||||||
|
int m = 0;
|
||||||
|
if (_hasMeta > 0)
|
||||||
|
{
|
||||||
|
if (_hasMeta > 1)
|
||||||
|
return _meta;
|
||||||
|
m = stack.getItemDamage();
|
||||||
|
Item item = stack.getItem();
|
||||||
|
if (item instanceof ItemBlock)
|
||||||
|
m = ((ItemBlock)item).getMetadata(m);
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to set the metdata of this ReplacementBlock to a fixed value
|
||||||
|
* @param meta The metadata of the block
|
||||||
|
* @return This instance
|
||||||
|
*/
|
||||||
|
public ReplacementBlock setMeta(int meta)
|
||||||
|
{
|
||||||
|
if (meta >= 0)
|
||||||
|
{
|
||||||
|
_hasMeta = 2;
|
||||||
|
_meta = meta;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to set the metdata of this ReplacementBlock to a value read from an ItemStack
|
||||||
|
* @param meta The metadata of the block
|
||||||
|
* @return This instance
|
||||||
|
*/
|
||||||
|
public ReplacementBlock setMeta(boolean hasMeta)
|
||||||
|
{
|
||||||
|
_hasMeta = (byte) (hasMeta ? 1 : 0);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to get the NBTTagCompound a TileEntity will read its state from
|
||||||
|
* @param world The world object
|
||||||
|
* @param x The X coord
|
||||||
|
* @param y The Y coord
|
||||||
|
* @param z The Z coord
|
||||||
|
* @param stack The ItemStack being used to replace the block (may be null)
|
||||||
|
* @return The NBTTagCompound a TileEntity will read its state from
|
||||||
|
*/
|
||||||
|
protected NBTTagCompound getTag(World world, int x, int y, int z, ItemStack stack)
|
||||||
|
{
|
||||||
|
return _tileTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to see if a TileEntity should have its state set
|
||||||
|
* @param stack The ItemStack being used to replace the block (may be null)
|
||||||
|
* @return True if the TileEntity should have its state set
|
||||||
|
*/
|
||||||
|
protected boolean hasTag(ItemStack stack)
|
||||||
|
{
|
||||||
|
return _tileTag != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReplacementBlock(Item block)
|
||||||
|
{
|
||||||
|
this(Block.getBlockFromItem(block));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReplacementBlock(Item block, NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
this(Block.getBlockFromItem(block), tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReplacementBlock(Block block)
|
||||||
|
{
|
||||||
|
this(block, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReplacementBlock(Block block, NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
_block = block;
|
||||||
|
_tileTag = tag;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class ValuedItem
|
||||||
|
{
|
||||||
|
public final int value;
|
||||||
|
public final ItemStack item;
|
||||||
|
public final String key;
|
||||||
|
public final Object object;
|
||||||
|
|
||||||
|
public ValuedItem(int v, ItemStack i)
|
||||||
|
{
|
||||||
|
value = v;
|
||||||
|
item = i;
|
||||||
|
key = null;
|
||||||
|
object = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValuedItem(String v, Object i)
|
||||||
|
{
|
||||||
|
value = -1;
|
||||||
|
item = null;
|
||||||
|
key = v;
|
||||||
|
object = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Presently unused but included so that if they do get used in the future,
|
||||||
|
* people including this in their jar and loading before MFR don't destroy everyone
|
||||||
|
*/
|
||||||
|
|
||||||
|
public ValuedItem(int v, Object i)
|
||||||
|
{
|
||||||
|
value = v;
|
||||||
|
item = null;
|
||||||
|
key = null;
|
||||||
|
object = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValuedItem(String v, ItemStack i)
|
||||||
|
{
|
||||||
|
value = -1;
|
||||||
|
item = i;
|
||||||
|
key = v;
|
||||||
|
object = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValuedItem(int v, String k, ItemStack i)
|
||||||
|
{
|
||||||
|
value = v;
|
||||||
|
item = i;
|
||||||
|
key = k;
|
||||||
|
object = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValuedItem(int v, String k, Object i)
|
||||||
|
{
|
||||||
|
value = v;
|
||||||
|
item = null;
|
||||||
|
key = k;
|
||||||
|
object = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValuedItem(int v, String k, ItemStack i, Object o)
|
||||||
|
{
|
||||||
|
value = v;
|
||||||
|
item = i;
|
||||||
|
key = k;
|
||||||
|
object = o;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a Block that can print information about itself using the RedNet Meter. This must be implemented on your Block class.
|
||||||
|
*/
|
||||||
|
public interface IRedNetInfo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This function appends information to a list provided to it.
|
||||||
|
*
|
||||||
|
* @param world Reference to the world.
|
||||||
|
* @param x X coordinate of the block.
|
||||||
|
* @param y Y coordinate of the block.
|
||||||
|
* @param z Z coordinate of the block.
|
||||||
|
* @param side The side of the block that is being queried.
|
||||||
|
* @param player Player doing the querying - this can be NULL.
|
||||||
|
* @param info The list that the information should be appended to.
|
||||||
|
*/
|
||||||
|
public void getRedNetInfo(IBlockAccess world, int x, int y, int z,
|
||||||
|
ForgeDirection side, EntityPlayer player, List<IChatComponent> info);
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a Block that can connect to RedNet cables. This must be implemented on your Block class.
|
||||||
|
* <p>
|
||||||
|
* Note that when you implement this, the RedNet network makes several assumptions about your code -
|
||||||
|
* It will not clamp values to 0 <= x <= 15. This means you must be able to accept any possible integer
|
||||||
|
* without crashing, even negatives. It will also assume that calling the onInput(s)Changed() methods
|
||||||
|
* are sufficient, and will not issue block updates. In Single mode, it will call onInputChanged.
|
||||||
|
* <p>
|
||||||
|
* RedNet cables have their subnets indicated to the user by colored bands on the cable.
|
||||||
|
* The color of a given subnet is the same as the wool with metadata equal to the subnet number.
|
||||||
|
* <p>
|
||||||
|
* For reference:<br>
|
||||||
|
* 0:White, 1:Orange, 2:Magenta, 3:LightBlue, 4:Yellow, 5:Lime, 6:Pink, 7:Gray,
|
||||||
|
* 8:LightGray, 9:Cyan, 10:Purple, 11:Blue, 12:Brown, 13:Green, 14:Red, 15:Black
|
||||||
|
*/
|
||||||
|
public interface IRedNetInputNode extends IRedNetConnection
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Called when the input values to this block change. Only called if your block is connected in "All" mode.
|
||||||
|
* Do not issue a network value update from inside this method call; it will be ignored. Issue your updates
|
||||||
|
* on the next tick.
|
||||||
|
*
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side the input values are being changed on.
|
||||||
|
* @param inputValues The new set of input values. This array will be 16 elements long. Do not alter or cache.
|
||||||
|
*/
|
||||||
|
public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the input value to this block changes. Only called if your block is connected in "Single" mode.
|
||||||
|
* Do not issue a network value update from inside this method call; it will be ignored. Issue your updates
|
||||||
|
* on the next tick.
|
||||||
|
*
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side the input values are being changed on.
|
||||||
|
* @param inputValue The new input value
|
||||||
|
*/
|
||||||
|
public void onInputChanged(World world, int x, int y, int z, ForgeDirection side, int inputValue);
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
public interface IRedNetLogicCircuit
|
||||||
|
{
|
||||||
|
public byte getInputCount();
|
||||||
|
|
||||||
|
public byte getOutputCount();
|
||||||
|
|
||||||
|
public int[] recalculateOutputValues(long worldTime, int[] inputValues);
|
||||||
|
|
||||||
|
public String getUnlocalizedName();
|
||||||
|
public String getInputPinLabel(int pin);
|
||||||
|
public String getOutputPinLabel(int pin);
|
||||||
|
|
||||||
|
public void readFromNBT(NBTTagCompound tag);
|
||||||
|
public void writeToNBT(NBTTagCompound tag);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author skyboy
|
||||||
|
*/
|
||||||
|
public interface IRedNetLogicPoint
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param out
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void transformOutput(int[] out);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param out
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void transformOutput(int out);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param in
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int[] transformInput(int[] in);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param in
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int transformInput(int in);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* You should not implement this yourself. Instead, use this to look for cables to notify from your IRedNetOmniNode as this does not
|
||||||
|
* require a block update. This will be implemented on the cable's Block class.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IRedNetNetworkContainer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Tells the network to recalculate all subnets.
|
||||||
|
* @param world The world this cable is in.
|
||||||
|
* @param x The x-coordinate of this cable.
|
||||||
|
* @param x The y-coordinate of this cable.
|
||||||
|
* @param x The z-coordinate of this cable.
|
||||||
|
*/
|
||||||
|
public void updateNetwork(World world, int x, int y, int z, ForgeDirection from);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells the network to recalculate a specific subnet.
|
||||||
|
* @param world The world this cable is in.
|
||||||
|
* @param x The x-coordinate of this cable.
|
||||||
|
* @param x The y-coordinate of this cable.
|
||||||
|
* @param x The z-coordinate of this cable.
|
||||||
|
* @param subnet The subnet to recalculate.
|
||||||
|
*/
|
||||||
|
public void updateNetwork(World world, int x, int y, int z, int subnet, ForgeDirection from);
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a Block that can connect to RedNet cables. This must be implemented on your Block class.
|
||||||
|
* <p>
|
||||||
|
* Note that when you implement this, the RedNet network makes several assumptions about your code -
|
||||||
|
* It will not clamp values to 0 <= x <= 15. This means you must be able to accept any possible integer
|
||||||
|
* without crashing, even negatives. It will also assume that calling the onInput(s)Changed() methods
|
||||||
|
* are sufficient, and will not issue block updates. It will never call the vanilla redstone output
|
||||||
|
* methods, and will only query the methods contained in this interface.
|
||||||
|
* <p>
|
||||||
|
* RedNet cables have their subnets indicated to the user by colored bands on the cable.
|
||||||
|
* The color of a given subnet is the same as the wool with metadata equal to the subnet number.
|
||||||
|
* <p>
|
||||||
|
* For reference:<br>
|
||||||
|
* 0:White, 1:Orange, 2:Magenta, 3:LightBlue, 4:Yellow, 5:Lime, 6:Pink, 7:Gray,
|
||||||
|
* 8:LightGray, 9:Cyan, 10:Purple, 11:Blue, 12:Brown, 13:Green, 14:Red, 15:Black
|
||||||
|
*/
|
||||||
|
public interface IRedNetOmniNode extends IRedNetInputNode, IRedNetOutputNode
|
||||||
|
{
|
||||||
|
// this is merely provided for convenience
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a Block that can connect to RedNet cables. This must be implemented on your Block class.
|
||||||
|
* <p>
|
||||||
|
* Note that when you implement this, the RedNet network makes several assumptions about your code -
|
||||||
|
* It will never call the vanilla redstone output methods, querying only the methods contained in
|
||||||
|
* this interface, and will not issue block updates.
|
||||||
|
* <p>
|
||||||
|
* RedNet cables have their subnets indicated to the user by colored bands on the cable.
|
||||||
|
* The color of a given subnet is the same as the wool with metadata equal to the subnet number.
|
||||||
|
* <p>
|
||||||
|
* For reference:<br>
|
||||||
|
* 0:White, 1:Orange, 2:Magenta, 3:LightBlue, 4:Yellow, 5:Lime, 6:Pink, 7:Gray,
|
||||||
|
* 8:LightGray, 9:Cyan, 10:Purple, 11:Blue, 12:Brown, 13:Green, 14:Red, 15:Black
|
||||||
|
*/
|
||||||
|
public interface IRedNetOutputNode extends IRedNetConnection
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns the output values of this RedNet node.
|
||||||
|
* This array must be 16 elements long.
|
||||||
|
* Only called if your block is connected in "All" mode.
|
||||||
|
*
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side the output values are required for.
|
||||||
|
* @return The output values.
|
||||||
|
*/
|
||||||
|
public int[] getOutputValues(World world, int x, int y, int z, ForgeDirection side);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the output value of this RedNet node for a given subnet.
|
||||||
|
* Must be the same as getOutputValues(world, x, y, z, side)[subnet].
|
||||||
|
*
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side the output value is required for.
|
||||||
|
* @param subnet The subnet to get the output value for (0-15).
|
||||||
|
* @return The output value.
|
||||||
|
*/
|
||||||
|
public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet);
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet.connectivity;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a Block that can connect to RedNet cables. This must be implemented on your Block class.
|
||||||
|
*/
|
||||||
|
public interface IRedNetConnection
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns the connection type of this Block. If this value must be changed
|
||||||
|
* while the block is alive, it must notify neighbors of a change.
|
||||||
|
* <p>
|
||||||
|
* For nodes that want to interact with rednet,
|
||||||
|
* see IRedNetInputNode, IRedNetOutputNode, and IRedNetOmniNode
|
||||||
|
*
|
||||||
|
* @param world The world this block is in.
|
||||||
|
* @param x This block's X coordinate.
|
||||||
|
* @param y This block's Y coordinate.
|
||||||
|
* @param z This block's Z coordinate.
|
||||||
|
* @param side The side that connection information is required for.
|
||||||
|
* @return The connection type.
|
||||||
|
*/
|
||||||
|
public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet.connectivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This must be implemented on your Block class.
|
||||||
|
* <p>
|
||||||
|
* RedNet cables will treat your block similar to a vanilla block that's not redstone active.
|
||||||
|
*/
|
||||||
|
public interface IRedNetDecorative
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet.connectivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This must be implemented on your Block class.
|
||||||
|
* <p>
|
||||||
|
* RedNet cables will not connect to your block.
|
||||||
|
* <br>
|
||||||
|
* This behavior can be overridden in subclasses by IRedNetConnection
|
||||||
|
*/
|
||||||
|
public interface IRedNetNoConnection
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet.connectivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This must be implemented on your Block class.
|
||||||
|
* <p>
|
||||||
|
* RedNet cables will treat your block similar to a redstone dust, and subtract one from the power value.
|
||||||
|
*/
|
||||||
|
public interface IRedstoneAlike {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package powercrystals.minefactoryreloaded.api.rednet.connectivity;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines how RedNet cable connects to a block
|
||||||
|
* <p>
|
||||||
|
* None: RedNet will never connect to this block (if this is all you want: use IRedNetNoConnection)
|
||||||
|
* <p>
|
||||||
|
* CableSingle: Connections will use the cable renderer with a single band, best used for whole blocks
|
||||||
|
* <br>
|
||||||
|
* PlateSingle: Connections will use the plate renderer with a single band, used for conveyers and rails
|
||||||
|
* <p>
|
||||||
|
* CableAll: Connections permit access to all 16 bands
|
||||||
|
* <br>
|
||||||
|
* PlateAll: Connections permit access to all 16 bands
|
||||||
|
* <p><p>
|
||||||
|
* Forced connection modes are best used for decoration blocks: RedNet will not connect normally,
|
||||||
|
* but will if the user forces it. Typically, IRedNetDecorative is desired for this instead
|
||||||
|
* <p>
|
||||||
|
* ForcedCableSingle: Connections permit access to a single band, only when the cable is in forced connection mode
|
||||||
|
* <br>
|
||||||
|
* ForcedPlateSingle: Connections permit access to a single band, only when the cable is in forced connection mode
|
||||||
|
* <p>
|
||||||
|
* ForcedCableAll: Connections permit access to all 16 bands, only when the cable is in forced connection mode
|
||||||
|
* <br>
|
||||||
|
* ForcedPlateAll: Connections permit access to all 16 bands, only when the cable is in forced connection mode
|
||||||
|
* <p><p>
|
||||||
|
* The decorative nodes are for when you want rednet to decide how to connect to your block,
|
||||||
|
* but also need to receive full updates from the network.
|
||||||
|
* <p>
|
||||||
|
* DecorativeSingle: Connections permit access to a single band, using standard connection logic
|
||||||
|
* <br>
|
||||||
|
* DecorativeAll: Connections permit access to all 16 bands, using standard connection logic
|
||||||
|
* <br>
|
||||||
|
* ForcedDecorativeSingle: Connections permit access to a single band, only when the cable is in forced connection mode
|
||||||
|
* <br>
|
||||||
|
* ForcedDecorativeAll: Connections permit access to all 16 bands, only when the cable is in forced connection mode
|
||||||
|
*/
|
||||||
|
public enum RedNetConnectionType
|
||||||
|
{
|
||||||
|
None, // 0; 0000000
|
||||||
|
CableSingle, // 11; 0001011
|
||||||
|
PlateSingle, // 13; 0001101
|
||||||
|
CableAll, // 19; 0010011
|
||||||
|
PlateAll, // 21; 0010101
|
||||||
|
ForcedCableSingle, // 43; 0101011
|
||||||
|
ForcedPlateSingle, // 45; 0101101
|
||||||
|
ForcedCableAll, // 51; 0110011
|
||||||
|
ForcedPlateAll, // 53; 0110101
|
||||||
|
DecorativeSingle, // NA; 0001001
|
||||||
|
DecorativeAll, // NA; 0010001
|
||||||
|
ForcedDecorativeSingle, // NA; 0101001
|
||||||
|
ForcedDecorativeAll; // NA; 0110001
|
||||||
|
|
||||||
|
public final boolean isConnected = this.ordinal() != 0; // 0 bit (mask: 1)
|
||||||
|
public final boolean isSingleSubnet = this.name().endsWith("Single"); // 3 bit (mask: 8)
|
||||||
|
public final boolean isAllSubnets = this.name().endsWith("All"); // 4 bit (mask: 16)
|
||||||
|
public final boolean isPlate = this.name().contains("Plate"); // 2 bit (mask: 4)
|
||||||
|
public final boolean isCable = this.name().contains("Cable"); // 1 bit (mask: 2)
|
||||||
|
public final boolean isConnectionForced = this.name().startsWith("Forced"); // 5 bit (mask: 32)
|
||||||
|
public final boolean isDecorative = this.name().contains("Decorative");
|
||||||
|
public final short flags = toFlags(isConnected, isCable, isPlate,
|
||||||
|
isSingleSubnet, isAllSubnets, isConnectionForced);
|
||||||
|
|
||||||
|
public static final RedNetConnectionType fromFlags(short flags)
|
||||||
|
{
|
||||||
|
return connections.get(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final short toFlags(boolean ...flags)
|
||||||
|
{
|
||||||
|
short ret = 0;
|
||||||
|
for (int i = flags.length; i --> 0;)
|
||||||
|
ret |= (flags[i] ? 1 : 0) << i;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, RedNetConnectionType> connections = new HashMap<Short, RedNetConnectionType>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
for (RedNetConnectionType type : RedNetConnectionType.values())
|
||||||
|
connections.put(type.flags, type);
|
||||||
|
}
|
||||||
|
}
|
|
@ -57,7 +57,7 @@ tooltip.actuallyadditions.blockPhantomface.desc.2=Input things into me to input
|
||||||
|
|
||||||
item.actuallyadditions.itemPhantomConnector.name=Phantom Connector
|
item.actuallyadditions.itemPhantomConnector.name=Phantom Connector
|
||||||
tooltip.actuallyadditions.itemPhantomConnector.desc.1=Connects a Phantom Face to any Inventory Block!
|
tooltip.actuallyadditions.itemPhantomConnector.desc.1=Connects a Phantom Face to any Inventory Block!
|
||||||
tooltip.actuallyadditions.itemPhantomConnector.desc.2=Press Control to clear the stored TileEntity
|
tooltip.actuallyadditions.itemPhantomConnector.desc.2=Hold ALT to clear the stored TileEntity
|
||||||
|
|
||||||
item.actuallyadditions.itemCanolaSeed.name=Canola Seeds
|
item.actuallyadditions.itemCanolaSeed.name=Canola Seeds
|
||||||
tooltip.actuallyadditions.itemCanolaSeed.desc=Grows on Grass!
|
tooltip.actuallyadditions.itemCanolaSeed.desc=Grows on Grass!
|
||||||
|
|
Loading…
Reference in a new issue