mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
More cleanup...
This commit is contained in:
parent
a0b8a83194
commit
9b93760445
16 changed files with 90 additions and 87 deletions
|
@ -168,7 +168,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
||||||
.save(consumer);
|
.save(consumer);
|
||||||
|
|
||||||
// Item Interface
|
// Item Interface
|
||||||
Recipe.shaped(ActuallyBlocks.ITEM_VIEWER.getItem())
|
Recipe.shaped(ActuallyBlocks.ITEM_INTERFACE.getItem())
|
||||||
.pattern("OBO", "RCR", "OBO")
|
.pattern("OBO", "RCR", "OBO")
|
||||||
.define('B', Tags.Items.DUSTS_REDSTONE)
|
.define('B', Tags.Items.DUSTS_REDSTONE)
|
||||||
.define('O', ActuallyItems.COIL.get())
|
.define('O', ActuallyItems.COIL.get())
|
||||||
|
@ -177,7 +177,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
||||||
.save(consumer);
|
.save(consumer);
|
||||||
|
|
||||||
// Hopping Item Interface
|
// Hopping Item Interface
|
||||||
Recipe.shapeless(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()).ingredients(ActuallyBlocks.ITEM_VIEWER.get()).save(consumer);
|
Recipe.shapeless(ActuallyBlocks.ITEM_INTERFACE_HOPPING.get()).ingredients(ActuallyBlocks.ITEM_INTERFACE.get()).save(consumer);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraftforge.common.ToolType;
|
import net.minecraftforge.common.ToolType;
|
||||||
import net.minecraftforge.fml.RegistryObject;
|
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
|
@ -156,9 +155,9 @@ public final class ActuallyBlocks {
|
||||||
// Interface Blocks
|
// Interface Blocks
|
||||||
public static final AABlockReg<BlockPlayerInterface, AABlockItem, TileEntityPlayerInterface> PLAYER_INTERFACE = new AABlockReg<>("player_interface", BlockPlayerInterface::new,
|
public static final AABlockReg<BlockPlayerInterface, AABlockItem, TileEntityPlayerInterface> PLAYER_INTERFACE = new AABlockReg<>("player_interface", BlockPlayerInterface::new,
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPlayerInterface::new);
|
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPlayerInterface::new);
|
||||||
public static final AABlockReg<BlockItemInterface, AABlockItem, TileEntityItemInterface> ITEM_VIEWER = new AABlockReg<>("item_viewer", BlockItemInterface::new,
|
public static final AABlockReg<BlockItemInterface, AABlockItem, TileEntityItemInterface> ITEM_INTERFACE = new AABlockReg<>("item_viewer", BlockItemInterface::new,
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterface::new);
|
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterface::new);
|
||||||
public static final AABlockReg<BlockItemInterfaceHopping, AABlockItem, TileEntityItemInterfaceHopping> ITEM_VIEWER_HOPPING = new AABlockReg<>("item_viewer_hopping", BlockItemInterfaceHopping::new,
|
public static final AABlockReg<BlockItemInterfaceHopping, AABlockItem, TileEntityItemInterfaceHopping> ITEM_INTERFACE_HOPPING = new AABlockReg<>("item_viewer_hopping", BlockItemInterfaceHopping::new,
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterfaceHopping::new);
|
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityItemInterfaceHopping::new);
|
||||||
|
|
||||||
// Phantom stuff
|
// Phantom stuff
|
||||||
|
|
|
@ -41,12 +41,12 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||||
return this.openGui(worldIn, player, pos, TileEntityMiner.class);
|
return this.openGui(worldIn, player, pos, TileEntityVerticalDigger.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity newBlockEntity(IBlockReader world) {
|
public TileEntity newBlockEntity(IBlockReader world) {
|
||||||
return new TileEntityMiner();
|
return new TileEntityVerticalDigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,8 +56,8 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos());
|
TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos());
|
||||||
if (tile instanceof TileEntityMiner) {
|
if (tile instanceof TileEntityVerticalDigger) {
|
||||||
TileEntityMiner miner = (TileEntityMiner) tile;
|
TileEntityVerticalDigger miner = (TileEntityVerticalDigger) tile;
|
||||||
String info = miner.checkY == 0
|
String info = miner.checkY == 0
|
||||||
? "Done Mining!"
|
? "Done Mining!"
|
||||||
: miner.checkY == -1
|
: miner.checkY == -1
|
||||||
|
|
|
@ -8,8 +8,6 @@ import net.minecraft.state.StateContainer;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
|
||||||
import net.minecraft.block.AbstractBlock.Properties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for Fully Direction block states extending from our base blocks. It's not super nice but it'll do.
|
* Wrapper for Fully Direction block states extending from our base blocks. It's not super nice but it'll do.
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +26,7 @@ public abstract class FullyDirectionalBlock extends BlockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockState getBaseConstructorState() {
|
public BlockState getBaseConstructorState() {
|
||||||
return this.stateContainer.getBaseState().with(FACING, Direction.NORTH);
|
return this.stateDefinition.getOwner().defaultBlockState().setValue(FACING, Direction.NORTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,17 +10,17 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
|
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class BookletChapterCrusher extends BookletChapter {
|
public class BookletChapterCrusher extends BookletChapter {
|
||||||
|
|
||||||
public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
||||||
|
@ -31,7 +31,7 @@ public class BookletChapterCrusher extends BookletChapter {
|
||||||
List<IBookletPage> allPages = new ArrayList<>();
|
List<IBookletPage> allPages = new ArrayList<>();
|
||||||
allPages.addAll(Arrays.asList(pages));
|
allPages.addAll(Arrays.asList(pages));
|
||||||
|
|
||||||
for (CrusherRecipe recipe : CrusherCrafting.MISC_RECIPES) {
|
for (CrushingRecipe recipe : CrusherCrafting.MISC_RECIPES) {
|
||||||
allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText());
|
allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.util.IItemProvider;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.crafting.IIngredientSerializer;
|
import net.minecraftforge.common.crafting.IIngredientSerializer;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class TargetNBTIngredient extends Ingredient {
|
public class TargetNBTIngredient extends Ingredient {
|
||||||
|
@ -19,6 +20,7 @@ public class TargetNBTIngredient extends Ingredient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nonnull
|
||||||
public IIngredientSerializer<? extends Ingredient> getSerializer() {
|
public IIngredientSerializer<? extends Ingredient> getSerializer() {
|
||||||
return SERIALIZER;
|
return SERIALIZER;
|
||||||
}
|
}
|
||||||
|
@ -29,13 +31,15 @@ public class TargetNBTIngredient extends Ingredient {
|
||||||
public static TargetNBTIngredient of(ItemStack itemStack) {
|
public static TargetNBTIngredient of(ItemStack itemStack) {
|
||||||
return new TargetNBTIngredient(Stream.of(new SingleItemList(itemStack)));
|
return new TargetNBTIngredient(Stream.of(new SingleItemList(itemStack)));
|
||||||
}
|
}
|
||||||
public static TargetNBTIngredient of(ITag tag) {
|
@Nonnull
|
||||||
|
public static TargetNBTIngredient of(@Nonnull ITag tag) {
|
||||||
return new TargetNBTIngredient(Stream.of(new TagList(tag)));
|
return new TargetNBTIngredient(Stream.of(new TagList(tag)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nonnull
|
||||||
public JsonElement toJson() {
|
public JsonElement toJson() {
|
||||||
JsonObject tmp = super.toJson().getAsJsonObject();
|
JsonObject tmp = super.toJson().getAsJsonObject();
|
||||||
tmp.addProperty("type", Serializer.NAME.toString());
|
tmp.addProperty("type", Serializer.NAME.toString());
|
||||||
|
@ -48,12 +52,14 @@ public class TargetNBTIngredient extends Ingredient {
|
||||||
public static ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "nbt_target");
|
public static ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "nbt_target");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nonnull
|
||||||
public TargetNBTIngredient parse(PacketBuffer buffer) {
|
public TargetNBTIngredient parse(PacketBuffer buffer) {
|
||||||
return new TargetNBTIngredient(Stream.generate(() -> new SingleItemList(buffer.readItem())).limit(buffer.readVarInt()));
|
return new TargetNBTIngredient(Stream.generate(() -> new SingleItemList(buffer.readItem())).limit(buffer.readVarInt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TargetNBTIngredient parse(JsonObject json) {
|
@Nonnull
|
||||||
|
public TargetNBTIngredient parse(@Nonnull JsonObject json) {
|
||||||
return new TargetNBTIngredient(Stream.of(Ingredient.valueFromJson(json)));
|
return new TargetNBTIngredient(Stream.of(Ingredient.valueFromJson(json)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,8 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.entity;
|
package de.ellpeck.actuallyadditions.mod.entity;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
|
||||||
|
|
||||||
|
|
||||||
public final class InitEntities {
|
public final class InitEntities {
|
||||||
|
@ -21,12 +20,12 @@ public final class InitEntities {
|
||||||
public static void init() {
|
public static void init() {
|
||||||
ActuallyAdditions.LOGGER.info("Initializing Entities...");
|
ActuallyAdditions.LOGGER.info("Initializing Entities...");
|
||||||
|
|
||||||
EntityRegistry.registerModEntity(new ResourceLocation(ActuallyAdditions.MODID, "worm"), EntityWorm.class, ActuallyAdditions.MODID + ".worm", 0, ActuallyAdditions.INSTANCE, 64, 1, false);
|
//EntityRegistry.registerModEntity(new ResourceLocation(ActuallyAdditions.MODID, "worm"), EntityWorm.class, ActuallyAdditions.MODID + ".worm", 0, ActuallyAdditions.INSTANCE, 64, 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void initClient() {
|
public static void initClient() {
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityWorm.class, RenderWorm::new);
|
//RenderingRegistry.registerEntityRenderingHandler(EntityWorm.class, RenderWorm::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,15 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.entity;
|
package de.ellpeck.actuallyadditions.mod.entity;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
import com.sun.prism.TextureMap;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.entity.Render;
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
|
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
|
||||||
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
|
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
|
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||||
|
@ -41,8 +42,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
|
||||||
|
|
||||||
public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer, INamedContainerProvider {
|
public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer, INamedContainerProvider {
|
||||||
|
|
||||||
private static final List<IFarmerBehavior> SORTED_FARMER_BEHAVIORS = new ArrayList<>();
|
private static final List<IFarmerBehavior> SORTED_FARMER_BEHAVIORS = new ArrayList<>();
|
||||||
|
@ -55,7 +54,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
|
||||||
private int lastEnergy;
|
private int lastEnergy;
|
||||||
|
|
||||||
public TileEntityFarmer() {
|
public TileEntityFarmer() {
|
||||||
super(ActuallyTiles.FARMER_TILE.get(), 12);
|
super(ActuallyBlocks.FARMER.getTileEntityType(), 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
|
@ -41,9 +42,6 @@ import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
|
|
||||||
|
|
||||||
public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider {
|
public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider {
|
||||||
|
|
||||||
public boolean isPlacer;
|
public boolean isPlacer;
|
||||||
|
@ -84,7 +82,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntityFluidCollector() {
|
public TileEntityFluidCollector() {
|
||||||
this(ActuallyTiles.FLUIDCOLLECTOR_TILE.get());
|
this(ActuallyBlocks.FLUID_COLLECTOR.getTileEntityType());
|
||||||
this.isPlacer = false;
|
this.isPlacer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
|
|
||||||
public class TileEntityFluidPlacer extends TileEntityFluidCollector {
|
public class TileEntityFluidPlacer extends TileEntityFluidCollector {
|
||||||
|
|
||||||
public TileEntityFluidPlacer() {
|
public TileEntityFluidPlacer() {
|
||||||
super(ActuallyTiles.FLUIDPLACER_TILE.get());
|
super(ActuallyBlocks.FLUID_PLACER.getTileEntityType());
|
||||||
this.isPlacer = true;
|
this.isPlacer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.laser.Network;
|
import de.ellpeck.actuallyadditions.api.laser.Network;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
|
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
@ -66,9 +67,9 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
IItemHandlerInfo info = TileEntityItemInterface.this.getSwitchedIndexHandler(slot);
|
IItemHandlerInfo info = TileEntityItemInterface.this.getSwitchedIndexHandler(slot);
|
||||||
if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stack, false)) {
|
if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stack, false)) {
|
||||||
ItemStack remain = info.handler.insertItem(info.switchedIndex, stack, simulate);
|
ItemStack remain = info.handler.insertItem(info.switchedIndex, stack, simulate);
|
||||||
if (!ItemStack.areItemStacksEqual(remain, stack) && !simulate) {
|
if (!ItemStack.isSame(remain, stack) && !simulate) {
|
||||||
TileEntityItemInterface.this.markDirty();
|
TileEntityItemInterface.this.setChanged();
|
||||||
TileEntityItemInterface.this.doItemParticle(stack, info.relayInQuestion.getPos(), TileEntityItemInterface.this.connectedRelay.getPos());
|
TileEntityItemInterface.this.doItemParticle(stack, info.relayInQuestion.getBlockPos(), TileEntityItemInterface.this.connectedRelay.getBlockPos());
|
||||||
}
|
}
|
||||||
return remain;
|
return remain;
|
||||||
}
|
}
|
||||||
|
@ -83,8 +84,8 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stackIn, true)) {
|
if (info != null && info.isLoaded() && TileEntityItemInterface.this.isWhitelisted(info, stackIn, true)) {
|
||||||
ItemStack extracted = info.handler.extractItem(info.switchedIndex, amount, simulate);
|
ItemStack extracted = info.handler.extractItem(info.switchedIndex, amount, simulate);
|
||||||
if (StackUtil.isValid(extracted) && !simulate) {
|
if (StackUtil.isValid(extracted) && !simulate) {
|
||||||
TileEntityItemInterface.this.markDirty();
|
TileEntityItemInterface.this.setChanged();
|
||||||
TileEntityItemInterface.this.doItemParticle(extracted, TileEntityItemInterface.this.connectedRelay.getPos(), info.relayInQuestion.getPos());
|
TileEntityItemInterface.this.doItemParticle(extracted, TileEntityItemInterface.this.connectedRelay.getBlockPos(), info.relayInQuestion.getBlockPos());
|
||||||
}
|
}
|
||||||
return extracted;
|
return extracted;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +119,7 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntityItemInterface() {
|
public TileEntityItemInterface() {
|
||||||
this(ActuallyTiles.ITEMVIEWER_TILE.get());
|
this(ActuallyBlocks.ITEM_INTERFACE.getTileEntityType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -153,9 +154,9 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) {
|
public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) {
|
||||||
if (!this.world.isRemote) {
|
if (!this.level.isClientSide) {
|
||||||
CompoundNBT compound = new CompoundNBT();
|
CompoundNBT compound = new CompoundNBT();
|
||||||
stack.write(compound);
|
stack.save(compound);
|
||||||
|
|
||||||
compound.putDouble("InX", input.getX());
|
compound.putDouble("InX", input.getX());
|
||||||
compound.putDouble("InY", input.getY());
|
compound.putDouble("InY", input.getY());
|
||||||
|
@ -166,9 +167,9 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
compound.putDouble("OutZ", output.getZ());
|
compound.putDouble("OutZ", output.getZ());
|
||||||
|
|
||||||
int rangeSq = 16 * 16;
|
int rangeSq = 16 * 16;
|
||||||
for (PlayerEntity player : this.world.getPlayers()) {
|
for (PlayerEntity player : this.level.players()) {
|
||||||
if (player instanceof ServerPlayerEntity) {
|
if (player instanceof ServerPlayerEntity) {
|
||||||
if (player.getDistanceSq(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.getDistanceSq(output.getX(), output.getY(), output.getZ()) <= rangeSq) {
|
if (player.distanceToSqr(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.distanceToSqr(output.getX(), output.getY(), output.getZ()) <= rangeSq) {
|
||||||
PacketHandler.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayerEntity) player);
|
PacketHandler.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayerEntity) player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,13 +250,13 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
@Override
|
@Override
|
||||||
public void saveDataOnChangeOrWorldStart() {
|
public void saveDataOnChangeOrWorldStart() {
|
||||||
TileEntityLaserRelayItem tileFound = null;
|
TileEntityLaserRelayItem tileFound = null;
|
||||||
if (this.world != null) { //Why is that even possible..?
|
if (this.level != null) { //Why is that even possible..?
|
||||||
for (int i = 0; i <= 5; i++) {
|
for (int i = 0; i <= 5; i++) {
|
||||||
Direction side = WorldUtil.getDirectionBySidesInOrder(i);
|
Direction side = WorldUtil.getDirectionBySidesInOrder(i);
|
||||||
BlockPos pos = this.getPos().offset(side);
|
BlockPos pos = this.getBlockPos().relative(side);
|
||||||
|
|
||||||
if (this.world.isBlockLoaded(pos)) {
|
if (this.level.isLoaded(pos)) {
|
||||||
TileEntity tile = this.world.getTileEntity(pos);
|
TileEntity tile = this.level.getBlockEntity(pos);
|
||||||
|
|
||||||
if (tile instanceof TileEntityLaserRelayItem) {
|
if (tile instanceof TileEntityLaserRelayItem) {
|
||||||
if (tileFound != null) {
|
if (tileFound != null) {
|
||||||
|
@ -312,7 +313,7 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoaded() {
|
public boolean isLoaded() {
|
||||||
return this.relayInQuestion.hasWorld() && this.relayInQuestion.getWorld().isBlockLoaded(this.relayInQuestion.getPos());
|
return this.relayInQuestion.hasLevel() && this.relayInQuestion.getLevel().isLoaded(this.relayInQuestion.getBlockPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +327,7 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoaded() {
|
public boolean isLoaded() {
|
||||||
return this.relayInQuestion.hasWorld() && this.relayInQuestion.getWorld().isBlockLoaded(this.relayInQuestion.getPos());
|
return this.relayInQuestion.hasLevel() && this.relayInQuestion.getLevel().isLoaded(this.relayInQuestion.getBlockPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,15 +11,18 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
|
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.EntityPredicates;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
@ -34,7 +37,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
|
||||||
private SlotlessableItemHandlerWrapper handlerToPushTo;
|
private SlotlessableItemHandlerWrapper handlerToPushTo;
|
||||||
|
|
||||||
public TileEntityItemInterfaceHopping() {
|
public TileEntityItemInterfaceHopping() {
|
||||||
super(ActuallyTiles.ITEMVIEWERHOPPING_TILE.get());
|
super(ActuallyBlocks.ITEM_INTERFACE_HOPPING.getTileEntityType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,12 +45,14 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
// TODO: [port] validate this is the correct way to get total game time getGameTime
|
// TODO: [port] validate this is the correct way to get total game time getGameTime
|
||||||
if (!this.world.isRemote && this.world.getWorldInfo().getGameTime() % 10 == 0) {
|
if (!this.level.isClientSide && this.level.getLevelData().getGameTime() % 10 == 0) {
|
||||||
if (this.handlerToPullFrom != null) {
|
if (this.handlerToPullFrom != null) {
|
||||||
WorldUtil.doItemInteraction(this.handlerToPullFrom, this.itemHandler, 4);
|
WorldUtil.doItemInteraction(this.handlerToPullFrom, this.itemHandler, 4);
|
||||||
} else {
|
} else {
|
||||||
if (this.world.getWorldInfo().getGameTime() % 20 == 0) {
|
if (this.level.getLevelData().getGameTime() % 20 == 0) {
|
||||||
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos.getX(), this.pos.getY() + 0.5, this.pos.getZ(), this.pos.getX() + 1, this.pos.getY() + 2, this.pos.getZ() + 1));
|
//TODO hmm?
|
||||||
|
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(this.getBlockPos().getX(), this.getBlockPos().getY() + 0.5, this.getBlockPos().getZ(), this.getBlockPos().getX() + 1, this.getBlockPos().getY() + 2, this.getBlockPos().getZ() + 1);
|
||||||
|
List<ItemEntity> items = this.level.getEntities(EntityType.ITEM, axisAlignedBB, EntityPredicates.ENTITY_STILL_ALIVE);
|
||||||
if (items != null && !items.isEmpty()) {
|
if (items != null && !items.isEmpty()) {
|
||||||
for (ItemEntity item : items) {
|
for (ItemEntity item : items) {
|
||||||
if (item != null && item.isAlive()) {
|
if (item != null && item.isAlive()) {
|
||||||
|
@ -96,7 +101,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
|
||||||
this.handlerToPullFrom = null;
|
this.handlerToPullFrom = null;
|
||||||
this.handlerToPushTo = null;
|
this.handlerToPushTo = null;
|
||||||
|
|
||||||
TileEntity from = this.world.getTileEntity(this.pos.offset(Direction.UP));
|
TileEntity from = this.level.getBlockEntity(this.getBlockPos().relative(Direction.UP));
|
||||||
if (from != null && !(from instanceof TileEntityItemInterface)) {
|
if (from != null && !(from instanceof TileEntityItemInterface)) {
|
||||||
LazyOptional<IItemHandler> normal = from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN);
|
LazyOptional<IItemHandler> normal = from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN);
|
||||||
|
|
||||||
|
@ -112,12 +117,12 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
|
||||||
this.handlerToPullFrom = new SlotlessableItemHandlerWrapper(normal, slotless);
|
this.handlerToPullFrom = new SlotlessableItemHandlerWrapper(normal, slotless);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockState state = this.world.getBlockState(this.pos);
|
BlockState state = this.level.getBlockState(this.getBlockPos());
|
||||||
Direction facing = state.get(BlockStateProperties.FACING);
|
Direction facing = state.getValue(BlockStateProperties.FACING);
|
||||||
|
|
||||||
BlockPos toPos = this.pos.offset(facing);
|
BlockPos toPos = this.getBlockPos().relative(facing);
|
||||||
if (this.world.isBlockLoaded(toPos)) {
|
if (this.level.isLoaded(toPos)) {
|
||||||
TileEntity to = this.world.getTileEntity(toPos);
|
TileEntity to = this.level.getBlockEntity(toPos);
|
||||||
if (to != null && !(to instanceof TileEntityItemInterface)) {
|
if (to != null && !(to instanceof TileEntityItemInterface)) {
|
||||||
LazyOptional<IItemHandler> normal = to.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite());
|
LazyOptional<IItemHandler> normal = to.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite());
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,6 @@ import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
|
|
||||||
|
|
||||||
public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler, INamedContainerProvider {
|
public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler, INamedContainerProvider {
|
||||||
|
|
||||||
int[] i = ConfigIntListValues.OIL_POWER.getValue();
|
int[] i = ConfigIntListValues.OIL_POWER.getValue();
|
||||||
|
@ -59,12 +56,12 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
|
||||||
return FluidStack.EMPTY;
|
return FluidStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//@Override
|
||||||
public boolean canFillFluidType(FluidStack stack) {
|
public boolean canFillFluidType(FluidStack stack) {
|
||||||
Fluid fluid = stack == null
|
Fluid fluid = stack == null
|
||||||
? null
|
? null
|
||||||
: stack.getFluid();
|
: stack.getFluid();
|
||||||
return fluid != null && getRecipeForFluid(fluid.getName()) != null;
|
return fluid != null && getRecipeForFluid(fluid.getRegistryName().toString()) != null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public final LazyOptional<IFluidHandler> lazyTank = LazyOptional.of(() -> this.tank);
|
public final LazyOptional<IFluidHandler> lazyTank = LazyOptional.of(() -> this.tank);
|
||||||
|
@ -103,7 +100,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
Fluid fluid = stack.getFluid();
|
Fluid fluid = stack.getFluid();
|
||||||
if (fluid != null) {
|
if (fluid != null) {
|
||||||
return getRecipeForFluid(fluid.getName());
|
return getRecipeForFluid(fluid.getRegistryName().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
||||||
|
@ -23,13 +24,12 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.FurnaceRecipe;
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.datafix.fixes.FurnaceRecipes;
|
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraftforge.common.util.Constants;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
private boolean lastSmelted;
|
private boolean lastSmelted;
|
||||||
|
|
||||||
public TileEntityPoweredFurnace() {
|
public TileEntityPoweredFurnace() {
|
||||||
super(ActuallyTiles.FURNACE_DOUBLE_TILE.get(), 4);
|
super(ActuallyBlocks.POWERED_FURNACE.getTileEntityType(), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void autoSplit(ItemStackHandlerAA inv, int slot1, int slot2) {
|
public static void autoSplit(ItemStackHandlerAA inv, int slot1, int slot2) {
|
||||||
|
@ -111,7 +111,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (!this.world.isRemote) {
|
if (!this.level.isClientSide) {
|
||||||
if (this.isAutoSplit) {
|
if (this.isAutoSplit) {
|
||||||
autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2);
|
autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2);
|
||||||
}
|
}
|
||||||
|
@ -149,8 +149,8 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
this.secondSmeltTime = 0;
|
this.secondSmeltTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockState currState = this.world.getBlockState(this.pos);
|
BlockState currState = this.level.getBlockState(this.getBlockPos());
|
||||||
boolean current = currState.get(BlockStateProperties.LIT);
|
boolean current = currState.getValue(BlockStateProperties.LIT);
|
||||||
boolean changeTo = current;
|
boolean changeTo = current;
|
||||||
if (this.lastSmelted != smelted) {
|
if (this.lastSmelted != smelted) {
|
||||||
changeTo = smelted;
|
changeTo = smelted;
|
||||||
|
@ -163,7 +163,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changeTo != current) {
|
if (changeTo != current) {
|
||||||
this.world.setBlockState(this.pos, currState.with(BlockStateProperties.LIT, changeTo));
|
this.level.setBlock(this.worldPosition, currState.setValue(BlockStateProperties.LIT, changeTo), Constants.BlockFlags.DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastSmelted = smelted;
|
this.lastSmelted = smelted;
|
||||||
|
@ -179,7 +179,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAcceptor getAcceptor() {
|
public IAcceptor getAcceptor() {
|
||||||
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && StackUtil.isValid(FurnaceRecipes.instance().getSmeltingResult(stack));
|
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2); //&& StackUtil.isValid(FurnaceRecipes.instance().getSmeltingResult(stack)); //TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -189,9 +189,9 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
|
|
||||||
public boolean canSmeltOn(int theInput, int theOutput) {
|
public boolean canSmeltOn(int theInput, int theOutput) {
|
||||||
if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) {
|
if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) {
|
||||||
ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.inv.getStackInSlot(theInput));
|
ItemStack output = ItemStack.EMPTY; //FurnaceRecipes.instance().getSmeltingResult(this.inv.getStackInSlot(theInput)); //TODO
|
||||||
if (StackUtil.isValid(output)) {
|
if (StackUtil.isValid(output)) {
|
||||||
if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).isItemEqual(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) {
|
if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).sameItem(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishBurning(int theInput, int theOutput) {
|
public void finishBurning(int theInput, int theOutput) {
|
||||||
ItemStack output = FurnaceRecipe.instance().getSmeltingResult(this.inv.getStackInSlot(theInput));
|
ItemStack output = ItemStack.EMPTY; //FurnaceRecipe.instance().getSmeltingResult(this.inv.getStackInSlot(theInput)); //TODO
|
||||||
if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput))) {
|
if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput))) {
|
||||||
this.inv.setStackInSlot(theOutput, output.copy());
|
this.inv.setStackInSlot(theOutput, output.copy());
|
||||||
} else if (this.inv.getStackInSlot(theOutput).getItem() == output.getItem()) {
|
} else if (this.inv.getStackInSlot(theOutput).getItem() == output.getItem()) {
|
||||||
|
@ -223,7 +223,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
public void onButtonPressed(int buttonID, PlayerEntity player) {
|
public void onButtonPressed(int buttonID, PlayerEntity player) {
|
||||||
if (buttonID == 0) {
|
if (buttonID == 0) {
|
||||||
this.isAutoSplit = !this.isAutoSplit;
|
this.isAutoSplit = !this.isAutoSplit;
|
||||||
this.markDirty();
|
this.setChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||||
|
@ -31,15 +32,13 @@ import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
|
||||||
|
|
||||||
public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
|
public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
|
||||||
|
|
||||||
public static final int RANGE = 6;
|
public static final int RANGE = 6;
|
||||||
public FilterSettings filter = new FilterSettings(12, true, true, false, false, 0, -1000);
|
public FilterSettings filter = new FilterSettings(12, true, true, false, false, 0, -1000);
|
||||||
|
|
||||||
public TileEntityRangedCollector() {
|
public TileEntityRangedCollector() {
|
||||||
super(ActuallyTiles.RANGEDCOLLECTOR_TILE.get(), 6);
|
super(ActuallyBlocks.RANGED_COLLECTOR.getTileEntityType(), 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue