Last few fixes. 0.6.11 done

This commit is contained in:
Raoul Van den Berge
2016-05-23 18:01:00 +02:00
parent 4a41e8b7c6
commit e0f13bc886
12 changed files with 49 additions and 36 deletions

View File

@@ -19,7 +19,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import refinedstorage.RefinedStorage;
import refinedstorage.RefinedStorageBlocks;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.item.ItemBlockBase;
import refinedstorage.tile.TileBase;
@@ -104,19 +103,12 @@ public abstract class BlockBase extends Block {
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemStack) {
super.onBlockPlacedBy(world, pos, state, player, itemStack);
Block blockPlaced = state.getBlock();
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileBase) {
EnumFacing facing = BlockPistonBase.getFacingFromEntity(pos, player);
if (player.isSneaking() && (blockPlaced == RefinedStorageBlocks.IMPORTER ||
blockPlaced == RefinedStorageBlocks.EXPORTER ||
blockPlaced == RefinedStorageBlocks.EXTERNAL_STORAGE ||
blockPlaced == RefinedStorageBlocks.CONSTRUCTOR ||
blockPlaced == RefinedStorageBlocks.DESTRUCTOR ||
blockPlaced == RefinedStorageBlocks.CRAFTER)) {
if (player.isSneaking() && hasOppositeFacingOnSneakPlace()) {
facing = facing.getOpposite();
}
@@ -160,4 +152,8 @@ public abstract class BlockBase extends Block {
public Item createItemForBlock() {
return new ItemBlockBase(this, false);
}
public boolean hasOppositeFacingOnSneakPlace() {
return false;
}
}

View File

@@ -30,4 +30,9 @@ public class BlockConstructor extends BlockMachine {
return true;
}
@Override
public boolean hasOppositeFacingOnSneakPlace() {
return true;
}
}

View File

@@ -30,4 +30,9 @@ public class BlockCrafter extends BlockMachine {
return true;
}
@Override
public boolean hasOppositeFacingOnSneakPlace() {
return true;
}
}

View File

@@ -30,4 +30,9 @@ public class BlockDestructor extends BlockMachine {
return true;
}
@Override
public boolean hasOppositeFacingOnSneakPlace() {
return true;
}
}

View File

@@ -30,4 +30,9 @@ public class BlockExporter extends BlockMachine {
return true;
}
@Override
public boolean hasOppositeFacingOnSneakPlace() {
return true;
}
}

View File

@@ -30,4 +30,9 @@ public class BlockExternalStorage extends BlockMachine {
return true;
}
@Override
public boolean hasOppositeFacingOnSneakPlace() {
return true;
}
}

View File

@@ -30,4 +30,9 @@ public class BlockImporter extends BlockMachine {
return true;
}
@Override
public boolean hasOppositeFacingOnSneakPlace() {
return true;
}
}

View File

@@ -33,7 +33,11 @@ public class TileDestructor extends TileMachine implements ICompareConfig, IMode
public static final int BASE_SPEED = 20;
private BasicItemHandler filters = new BasicItemHandler(9, this);
private BasicItemHandler upgrades = new BasicItemHandler(4, this, new BasicItemValidator(RefinedStorageItems.UPGRADE, ItemUpgrade.TYPE_SPEED));
private BasicItemHandler upgrades = new BasicItemHandler(
4,
this,
new BasicItemValidator(RefinedStorageItems.UPGRADE, ItemUpgrade.TYPE_SPEED)
);
private int compare = 0;
private int mode = ModeConstants.WHITELIST;

View File

@@ -5,6 +5,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import refinedstorage.RefinedStorageItems;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.container.ContainerCrafter;
@@ -83,16 +84,6 @@ public class TileCrafter extends TileMachine {
@Override
public IItemHandler getDroppedItems() {
BasicItemHandler dummy = new BasicItemHandler(PATTERN_SLOTS + 4);
for (int i = 0; i < PATTERN_SLOTS; ++i) {
dummy.setStackInSlot(i, patterns.getStackInSlot(i));
}
for (int i = 0; i < 4; ++i) {
dummy.setStackInSlot(PATTERN_SLOTS + i, upgrades.getStackInSlot(i));
}
return dummy;
return new CombinedInvWrapper(patterns, upgrades);
}
}

View File

@@ -14,17 +14,17 @@ public class SoldererRegistry {
recipes.add(recipe);
}
public static ISoldererRecipe getRecipe(IItemHandler inventory) {
public static ISoldererRecipe getRecipe(IItemHandler items) {
for (ISoldererRecipe recipe : recipes) {
boolean ok = true;
for (int i = 0; i < 3; ++i) {
if (!RefinedStorageUtils.compareStackNoQuantity(recipe.getRow(i), inventory.getStackInSlot(i))) {
if (!RefinedStorageUtils.compareStackNoQuantity(recipe.getRow(i), items.getStackInSlot(i))) {
ok = false;
}
if (inventory.getStackInSlot(i) != null && recipe.getRow(i) != null) {
if (inventory.getStackInSlot(i).stackSize < recipe.getRow(i).stackSize) {
if (items.getStackInSlot(i) != null && recipe.getRow(i) != null) {
if (items.getStackInSlot(i).stackSize < recipe.getRow(i).stackSize) {
ok = false;
}
}

View File

@@ -8,6 +8,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import refinedstorage.RefinedStorageItems;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.container.ContainerSolderer;
@@ -179,17 +180,7 @@ public class TileSolderer extends TileMachine {
@Override
public IItemHandler getDroppedItems() {
BasicItemHandler dummy = new BasicItemHandler(4 + 4);
for (int i = 0; i < 4; ++i) {
dummy.setStackInSlot(i, items.getStackInSlot(i));
}
for (int i = 0; i < 4; ++i) {
dummy.setStackInSlot(4 + i, upgrades.getStackInSlot(i));
}
return dummy;
return new CombinedInvWrapper(items, upgrades);
}
@Override