it compiles :D
This commit is contained in:
parent
500ff29dbd
commit
6b9f6cb4f8
142 changed files with 755 additions and 1724 deletions
|
@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.Tickable;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.StringUtils;
|
||||
|
@ -42,7 +42,7 @@ import techreborn.init.TRTileEntities;
|
|||
import techreborn.utils.MessageIDs;
|
||||
|
||||
public class TileAlarm extends BlockEntity
|
||||
implements ITickable, IToolDrop {
|
||||
implements Tickable, IToolDrop {
|
||||
private int selectedSound = 1;
|
||||
|
||||
public TileAlarm() {
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -40,9 +43,6 @@ import techreborn.init.TRTileEntities;
|
|||
import techreborn.items.DynamicCell;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
@RebornRegister(TechReborn.MOD_ID)
|
||||
public class TileIndustrialCentrifuge extends TileGenericMachine implements IContainerProvider, IListInfoProvider {
|
||||
|
|
|
@ -32,10 +32,6 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
|
||||
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -43,7 +39,6 @@ import reborncore.common.tile.TileMachineBase;
|
|||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -199,12 +194,6 @@ public class TileTechStorageBase extends TileMachineBase
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(ClientConnection net, BlockEntityUpdateS2CPacket packet) {
|
||||
world.markBlockRangeForRenderUpdate(pos.getX(), pos.getY(), pos.getZ(), pos.getX(), pos.getY(), pos.getZ());
|
||||
fromTag(packet.getCompoundTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(CompoundTag tagCompound) {
|
||||
super.fromTag(tagCompound);
|
||||
|
|
|
@ -31,15 +31,10 @@ import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.Tickable;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
|
@ -57,7 +52,7 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public class TileCable extends BlockEntity
|
||||
implements Tickable, IEnergyStorage, IListInfoProvider, IToolDrop {
|
||||
implements Tickable, IListInfoProvider, IToolDrop {
|
||||
|
||||
public int power = 0;
|
||||
private int transferRate = 0;
|
||||
|
@ -77,14 +72,7 @@ public class TileCable extends BlockEntity
|
|||
//Something has gone wrong if this happens
|
||||
return TRContent.Cables.COPPER;
|
||||
}
|
||||
|
||||
public boolean canReceiveFromFace(Direction face) {
|
||||
if (sendingFace.contains(face)) {
|
||||
return false;
|
||||
}
|
||||
return canReceive();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CompoundTag toInitialChunkDataTag() {
|
||||
return toTag(new CompoundTag());
|
||||
|
@ -97,10 +85,6 @@ public class TileCable extends BlockEntity
|
|||
return new BlockEntityUpdateS2CPacket(getPos(), 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(ClientConnection net, BlockEntityUpdateS2CPacket packet) {
|
||||
fromTag(packet.getCompoundTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(CompoundTag compound) {
|
||||
|
@ -115,7 +99,6 @@ public class TileCable extends BlockEntity
|
|||
super.toTag(compound);
|
||||
if (power > 0) {
|
||||
CompoundTag data = new CompoundTag();
|
||||
data.putInt("power", getEnergyStored());
|
||||
compound.put("TileCable", data);
|
||||
}
|
||||
return compound;
|
||||
|
@ -138,10 +121,6 @@ public class TileCable extends BlockEntity
|
|||
sendingFace.clear();
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
if (!canExtract()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO needs a full recode to not use a specific power net
|
||||
|
||||
|
@ -178,59 +157,6 @@ public class TileCable extends BlockEntity
|
|||
// }
|
||||
}
|
||||
|
||||
// IEnergyStorage
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
if (!canReceive()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int energyReceived = Math.min(getMaxEnergyStored() - getEnergyStored(), Math.min(transferRate, maxReceive));
|
||||
if (!simulate) {
|
||||
power += energyReceived;
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
if (!canExtract()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int energyExtracted = Math.min(getEnergyStored(), Math.min(transferRate, maxExtract));
|
||||
if (!simulate) {
|
||||
power -= energyExtracted;
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return transferRate * 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtract() {
|
||||
if (getEnergyStored() == 0 ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceive() {
|
||||
if (getMaxEnergyStored() == getEnergyStored()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) {
|
||||
|
|
|
@ -27,7 +27,6 @@ package techreborn.tiles.generator;
|
|||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
|
|
@ -30,16 +30,15 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.config.ConfigRegistry;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.init.ModTags;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRTileEntities;
|
||||
import techreborn.utils.TagUtils;
|
||||
|
||||
@RebornRegister(TechReborn.MOD_ID)
|
||||
public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
||||
|
@ -83,10 +82,12 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
return;
|
||||
}
|
||||
final LightningEntity lightningBolt = new LightningEntity(world,
|
||||
pos.getX() + 0.5F,
|
||||
world.getTopPosition(),
|
||||
pos.getX() + 0.5F, world.getTopPosition(Heightmap.Type.MOTION_BLOCKING, getPos()).getY(),
|
||||
pos.getZ() + 0.5F, false);
|
||||
world.addWeatherEffect(lightningBolt);
|
||||
if(true){
|
||||
throw new RuntimeException("fix me");
|
||||
}
|
||||
//world.addWeatherEffect(lightningBolt);
|
||||
world.spawnEntity(lightningBolt);
|
||||
addEnergy(baseEnergyStrike * (0.3F + weatherStrength));
|
||||
((BlockMachineBase) world.getBlockState(pos).getBlock()).setActive(true, world, pos);
|
||||
|
@ -97,8 +98,8 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
public float getLightningStrikeMultiplier() {
|
||||
final float actualHeight = world.getDimension().getActualHeight();
|
||||
final float groundLevel = world.getTopPosition();
|
||||
final float actualHeight = 256;
|
||||
final float groundLevel = world.getTopPosition(Heightmap.Type.MOTION_BLOCKING, getPos()).getY();
|
||||
for (int i = pos.getY() + 1; i < actualHeight; i++) {
|
||||
if (!isValidIronFence(i)) {
|
||||
if (groundLevel >= i)
|
||||
|
@ -113,7 +114,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
|
||||
public boolean isValidIronFence(int y) {
|
||||
Block block = this.world.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock();
|
||||
if(TagUtils.hasTag(block, ModTags.FENCE_IRON)){
|
||||
if(block == TRContent.REFINED_IRON_FENCE){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -27,10 +27,10 @@ package techreborn.tiles.generator.basic;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BucketItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -70,7 +70,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
public static int getItemBurnTime(ItemStack stack) {
|
||||
return FurnaceBlockEntity.getBurnTimes().get(stack) / 4;
|
||||
return FurnaceBlockEntity.createFuelTimeMap().get(stack) / 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,7 +96,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
updateState();
|
||||
burnItem = inventory.getInvStack(fuelSlot);
|
||||
if (inventory.getInvStack(fuelSlot).getAmount() == 1) {
|
||||
if (inventory.getInvStack(fuelSlot).getItem() == Items.LAVA_BUCKET || inventory.getInvStack(fuelSlot).getItem() == ForgeMod.getInstance().universalBucket) {
|
||||
if (inventory.getInvStack(fuelSlot).getItem() == Items.LAVA_BUCKET || inventory.getInvStack(fuelSlot).getItem() instanceof BucketItem) {
|
||||
inventory.setStackInSlot(fuelSlot, new ItemStack(Items.BUCKET));
|
||||
} else {
|
||||
inventory.setStackInSlot(fuelSlot, ItemStack.EMPTY);
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
|
@ -86,11 +86,11 @@ public class TileIronFurnace extends TileMachineBase
|
|||
this.updateState();
|
||||
}
|
||||
if (this.fuel <= 0 && this.canSmelt()) {
|
||||
this.fuel = this.fuelGague = (int) (FurnaceBlockEntity.getBurnTimes().getOrDefault(inventory.getInvStack(this.fuelslot).getItem(), 0) * 1.25);
|
||||
this.fuel = this.fuelGague = (int) (FurnaceBlockEntity.createFuelTimeMap().getOrDefault(inventory.getInvStack(this.fuelslot).getItem(), 0) * 1.25);
|
||||
if (this.fuel > 0) {
|
||||
// Fuel slot
|
||||
ItemStack fuelStack = inventory.getInvStack(this.fuelslot);
|
||||
if (fuelStack.getItem().hasRecipeRemainder(fuelStack)) {
|
||||
if (fuelStack.getItem().hasRecipeRemainder()) {
|
||||
inventory.setStackInSlot(this.fuelslot, new ItemStack(fuelStack.getItem().getRecipeRemainder()));
|
||||
} else if (fuelStack.getAmount() > 1) {
|
||||
inventory.shrinkSlot(this.fuelslot, 1);
|
||||
|
@ -120,7 +120,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
|
||||
public void cookItems() {
|
||||
if (this.canSmelt()) {
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getInvStack(this.input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, inventory.getInvStack(this.input1));
|
||||
|
||||
if (inventory.getInvStack(this.output).isEmpty()) {
|
||||
inventory.setStackInSlot(this.output, itemstack.copy());
|
||||
|
@ -138,7 +138,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
public boolean canSmelt() {
|
||||
if (inventory.getInvStack(this.input1).isEmpty())
|
||||
return false;
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getInvStack(this.input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, inventory.getInvStack(this.input1));
|
||||
if (itemstack.isEmpty())
|
||||
return false;
|
||||
if (inventory.getInvStack(this.output).isEmpty())
|
||||
|
@ -154,7 +154,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
}
|
||||
|
||||
public ItemStack getResultFor(final ItemStack stack) {
|
||||
final ItemStack result = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, stack);
|
||||
final ItemStack result = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, stack);
|
||||
if (!result.isEmpty()) {
|
||||
return result.copy();
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
public static IInventoryAccess<TileIronFurnace> getInvetoryAccess(){
|
||||
return (slotID, stack, face, direction, tile) -> {
|
||||
if(direction == IInventoryAccess.AccessDirection.INSERT){
|
||||
boolean isFuel = FurnaceBlockEntity.isItemFuel(stack);
|
||||
boolean isFuel = FurnaceBlockEntity.canUseAsFuel(stack);
|
||||
if(isFuel){
|
||||
ItemStack fuelSlotStack = tile.inventory.getInvStack(tile.fuelslot);
|
||||
if(fuelSlotStack.isEmpty() || ItemUtils.isItemEqual(stack, fuelSlotStack, true, true) && fuelSlotStack.getMaxAmount() != fuelSlotStack.getAmount()){
|
||||
|
|
|
@ -41,7 +41,7 @@ import techreborn.init.TRTileEntities;
|
|||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
@RebornRegister(TechReborn.MOD_ID)
|
||||
public class TileEnvTypeillationTower extends TileGenericMachine implements IContainerProvider {
|
||||
public class TileDistillationTower extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "EnvTypeillation_tower", key = "EnvTypeillationTowerMaxInput", comment = "EnvTypeillation Tower Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
|
@ -50,7 +50,7 @@ public class TileEnvTypeillationTower extends TileGenericMachine implements ICon
|
|||
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
||||
public TileEnvTypeillationTower() {
|
||||
public TileDistillationTower() {
|
||||
super(TRTileEntities.EnvTypeILLATION_TOWER,"EnvTypeillationTower", maxInput, maxEnergy, TRContent.Machine.EnvTypeILLATION_TOWER.block, 6);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[] { 2, 3, 4, 5 };
|
||||
|
|
|
@ -33,7 +33,6 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
|||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.config.ConfigRegistry;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.IInventoryAccess;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
|
|
|
@ -139,13 +139,6 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
|
|||
super.tick();
|
||||
}
|
||||
}
|
||||
|
||||
// TileMachineBase
|
||||
@Override
|
||||
public void onDataPacket(final ClientConnection net, final BlockEntityUpdateS2CPacket packet) {
|
||||
world.markBlockRangeForRenderUpdate(pos.getX(), pos.getY(), pos.getZ(), pos.getX(), pos.getY(), pos.getZ());
|
||||
fromTag(packet.getCompoundTag());
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
|
|
|
@ -30,8 +30,6 @@ import net.minecraft.block.Material;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
@ -82,7 +80,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
|
|||
final boolean blade = multiblockChecker.checkRingY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 1, 0));
|
||||
final BlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = ((centerBlock.getBlock() instanceof FluidBlock
|
||||
|| centerBlock.getBlock() instanceof IFluidBlock)
|
||||
|| centerBlock.getBlock() instanceof FluidBlock)
|
||||
&& centerBlock.getMaterial() == Material.WATER);
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
@ -90,7 +88,8 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
|
|||
private static IInventoryAccess<TileIndustrialGrinder> getInventoryAccess(){
|
||||
return (slotID, stack, face, direction, tile) -> {
|
||||
if(slotID == 1){
|
||||
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null).isPresent();
|
||||
//TODO check if the item has fluid in it
|
||||
//return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null).isPresent();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -30,24 +30,21 @@ import net.minecraft.block.Material;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.config.ConfigRegistry;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.IInventoryAccess;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import techreborn.init.ModRecipes;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRTileEntities;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -83,7 +80,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
|
|||
final boolean blade = multiblockChecker.checkRingY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 1, 0));
|
||||
final BlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = ((centerBlock.getBlock() instanceof FluidBlock
|
||||
|| centerBlock.getBlock() instanceof IFluidBlock)
|
||||
|| centerBlock.getBlock() instanceof FluidBlock)
|
||||
&& centerBlock.getMaterial() == Material.WATER);
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
@ -137,7 +134,8 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
|
|||
private static IInventoryAccess<TileIndustrialSawmill> getInventoryAccess(){
|
||||
return (slotID, stack, face, direction, tile) -> {
|
||||
if(direction == IInventoryAccess.AccessDirection.INSERT){
|
||||
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null).isPresent();
|
||||
//TODO return if the stack can take fluids
|
||||
//return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null).isPresent();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -31,10 +31,10 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
|
@ -93,7 +93,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
return lastRecipe;
|
||||
}
|
||||
}
|
||||
for (Recipe testRecipe : TRRecipeHandler.getRecipes(world, VanillaRecipeTypes.CRAFTING)) {
|
||||
for (Recipe testRecipe : TRRecipeHandler.getRecipes(world, RecipeType.CRAFTING)) {
|
||||
if (testRecipe.matches(crafting, world)) {
|
||||
lastRecipe = testRecipe;
|
||||
return testRecipe;
|
||||
|
@ -105,7 +105,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
|
||||
public CraftingInventory getCraftingInventory() {
|
||||
if (inventoryCrafting == null) {
|
||||
inventoryCrafting = new CraftingInventory(new Container() {
|
||||
inventoryCrafting = new CraftingInventory(new Container(null, -1) {
|
||||
@Override
|
||||
public boolean canUse(PlayerEntity playerIn) {
|
||||
return false;
|
||||
|
@ -125,7 +125,9 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
for (int i = 0; i < 9; i++) {
|
||||
stacksInSlots[i] = inventory.getInvStack(i).getAmount();
|
||||
}
|
||||
for (Ingredient ingredient : recipe.getPreviewInputs()) {
|
||||
|
||||
DefaultedList<Ingredient> ingredients = recipe.getPreviewInputs();
|
||||
for (Ingredient ingredient : ingredients) {
|
||||
if (ingredient != Ingredient.EMPTY) {
|
||||
boolean foundIngredient = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
|
@ -137,7 +139,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
if (stacksInSlots[i] > requiredSize) {
|
||||
if (ingredient.method_8093(stack)) {
|
||||
if (stack.getItem().getRecipeRemainder() != null) {
|
||||
if (!hasRoomForExtraItem(stack.getItem().getRecipeRemainder(stack))) {
|
||||
if (!hasRoomForExtraItem(new ItemStack(stack.getItem().getRecipeRemainder()))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +190,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
return false;
|
||||
}
|
||||
for (int i = 0; i < recipe.getPreviewInputs().size(); i++) {
|
||||
Ingredient ingredient = recipe.getPreviewInputs().get(i);
|
||||
DefaultedList<Ingredient> ingredients = recipe.getPreviewInputs();
|
||||
Ingredient ingredient = ingredients.get(i);
|
||||
// Looks for the best slot to take it from
|
||||
ItemStack bestSlot = inventory.getInvStack(i);
|
||||
if (ingredient.method_8093(bestSlot)) {
|
||||
|
@ -220,8 +223,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
private void handleContainerItem(ItemStack stack) {
|
||||
if (stack.getItem().hasRecipeRemainder(stack)) {
|
||||
ItemStack containerItem = stack.getItem().getRecipeRemainder(stack);
|
||||
if (stack.getItem().hasRecipeRemainder()) {
|
||||
ItemStack containerItem = new ItemStack(stack.getItem().getRecipeRemainder());
|
||||
ItemStack extraOutputSlot = inventory.getInvStack(10);
|
||||
if (hasOutputSpace(containerItem, 10)) {
|
||||
if (extraOutputSlot.isEmpty()) {
|
||||
|
@ -259,10 +262,11 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
if (recipe == null) {
|
||||
return -1;
|
||||
}
|
||||
DefaultedList<Ingredient> ingredients = recipe.getPreviewInputs();
|
||||
List<Integer> possibleSlots = new ArrayList<>();
|
||||
for (int i = 0; i < recipe.getPreviewInputs().size(); i++) {
|
||||
ItemStack stackInSlot = inventory.getInvStack(i);
|
||||
Ingredient ingredient = recipe.getPreviewInputs().get(i);
|
||||
Ingredient ingredient = ingredients.get(i);
|
||||
if (ingredient != Ingredient.EMPTY && ingredient.method_8093(stack)) {
|
||||
if (stackInSlot.isEmpty()) {
|
||||
possibleSlots.add(i);
|
||||
|
|
|
@ -27,8 +27,8 @@ package techreborn.tiles.machine.tier1;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
|
@ -71,7 +71,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
|
||||
public void cookItems() {
|
||||
if (canSmelt()) {
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getInvStack(input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, inventory.getInvStack(input1));
|
||||
|
||||
if (inventory.getInvStack(output).isEmpty()) {
|
||||
inventory.setStackInSlot(output, itemstack.copy());
|
||||
|
@ -90,7 +90,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
if (inventory.getInvStack(input1).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getInvStack(input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, inventory.getInvStack(input1));
|
||||
if (itemstack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public ItemStack getResultFor(ItemStack stack) {
|
||||
final ItemStack result = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, stack);
|
||||
final ItemStack result = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, stack);
|
||||
if (!result.isEmpty()) {
|
||||
return result.copy();
|
||||
}
|
||||
|
|
|
@ -38,9 +38,6 @@ import techreborn.blocks.tier1.BlockPlayerDetector;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRTileEntities;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@RebornRegister(TechReborn.MOD_ID)
|
||||
public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop {
|
||||
|
||||
|
@ -70,11 +67,8 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
boolean lastRedstone = redstone;
|
||||
redstone = false;
|
||||
if (canUseEnergy(euPerTick)) {
|
||||
Iterator<PlayerEntity> tIterator = super.world.getPlayers().iterator();
|
||||
while (tIterator.hasNext()) {
|
||||
PlayerEntity player = tIterator.next();
|
||||
if (player.squaredEnvTypeanceTo((double) super.getPos().getX() + 0.5D,
|
||||
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||
for(PlayerEntity player : world.getPlayers()){
|
||||
if (player.distanceTo(player) <= 256.0D) {
|
||||
String type = world.getBlockState(pos).get(BlockPlayerDetector.TYPE);
|
||||
if (type.equals("all")) {// ALL
|
||||
redstone = true;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.tiles.machine.tier1;
|
||||
|
||||
import net.minecraft.container.Container;
|
||||
import net.minecraft.container.ContainerType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -50,6 +51,7 @@ import techreborn.init.TRContent;
|
|||
import techreborn.init.TRTileEntities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -223,7 +225,7 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
List<Integer> possibleSlots = new ArrayList<>();
|
||||
for (int s = 0; s < currentRecipe.getPreviewInputs().size(); s++) {
|
||||
ItemStack stackInSlot = inventory.getInvStack(s);
|
||||
Ingredient ingredient = currentRecipe.getPreviewInputs().get(s);
|
||||
Ingredient ingredient = (Ingredient) currentRecipe.getPreviewInputs().get(s);
|
||||
if (ingredient != Ingredient.EMPTY && ingredient.method_8093(sourceStack)) {
|
||||
if (stackInSlot.isEmpty()) {
|
||||
possibleSlots.add(s);
|
||||
|
@ -406,6 +408,10 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
|
||||
private static class RollingTileContainer extends Container {
|
||||
|
||||
protected RollingTileContainer() {
|
||||
super(null, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse(final PlayerEntity entityplayer) {
|
||||
return true;
|
||||
|
|
|
@ -118,13 +118,7 @@ public class TileQuantumTank extends TileMachineBase
|
|||
writeWithoutCoords(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(final ClientConnection net, final BlockEntityUpdateS2CPacket packet) {
|
||||
world.markBlockRangeForRenderUpdate(pos.getX(), pos.getY(), pos.getZ(), pos.getX(), pos.getY(), pos.getZ());
|
||||
fromTag(packet.getCompoundTag());
|
||||
}
|
||||
|
||||
|
||||
// ItemHandlerProvider
|
||||
@Override
|
||||
public Inventory<TileQuantumTank> getInventory() {
|
||||
|
|
|
@ -25,11 +25,9 @@
|
|||
package techreborn.tiles.storage.idsu;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.WorldSavedDataStorage;
|
||||
|
||||
public class IDSUManager {
|
||||
public static IDataIDSU getData(World world) {
|
||||
WorldSavedDataStorage storage = world.getSavedDataStorage();
|
||||
throw new UnsupportedOperationException("needs rewriting anyway");
|
||||
// IDSUSaveManger instance = (IDSUSaveManger) storage.getOrLoadData(IDSUSaveManger.class, TechReborn.MOD_ID + "_IDSU");
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue