Reorganize, implement full multiblock test suite
Ported from 1.9.2 upwards, so there may be bugs. Still needs data generators to be added, that's a task for the future.
This commit is contained in:
parent
46e2dea59f
commit
f21a00ffd6
|
@ -25,7 +25,7 @@ minecraft {
|
||||||
// stable_# Stables are built at the discretion of the MCP team.
|
// stable_# Stables are built at the discretion of the MCP team.
|
||||||
// Use non-default mappings at your own risk. they may not always work.
|
// Use non-default mappings at your own risk. they may not always work.
|
||||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||||
mappings channel: 'snapshot', version: '20190719-1.14.3'
|
mappings channel: 'snapshot', version: '20200229-1.15.1'
|
||||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||||
|
|
||||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
@ -74,10 +74,10 @@ minecraft {
|
||||||
// Recommended logging level for the console
|
// Recommended logging level for the console
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
|
|
||||||
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')
|
args '--mod', 'engage', '--all', '--output', file('src/generated/resources/')
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
examplemod {
|
examplemod {Q
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.world.chunk.IChunk;
|
import net.minecraft.world.chunk.IChunk;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
@ -18,10 +19,16 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.bts.MultiblockRegistry;
|
||||||
import uk.gemwire.engage.blocks.Blocks;
|
import uk.gemwire.engage.blocks.Blocks;
|
||||||
|
import uk.gemwire.engage.blocks.tileEntities.EngageTETypes;
|
||||||
import uk.gemwire.engage.blocks.util.WCoreStruct;
|
import uk.gemwire.engage.blocks.util.WCoreStruct;
|
||||||
import uk.gemwire.engage.items.ItemProperties;
|
import uk.gemwire.engage.items.ItemProperties;
|
||||||
import uk.gemwire.engage.multiblocks.bts.MultiblockRegistry;
|
import uk.gemwire.engage.multiblock.warpcore.block.WarpCoreBlockPort;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.block.WarpCoreBlockType;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.block.WarpCoreBlockWall;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCorePowerTileEntity;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCoreTileEntity;
|
||||||
|
|
||||||
|
|
||||||
@Mod("engage")
|
@Mod("engage")
|
||||||
|
@ -48,11 +55,26 @@ public class Engage {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onBlockRegistry(final RegistryEvent.Register<Block> e) {
|
public static void onBlockRegistry(final RegistryEvent.Register<Block> e) {
|
||||||
e.getRegistry().register(new WCoreStruct());
|
e.getRegistry().register(new WCoreStruct());
|
||||||
|
e.getRegistry().register(new WarpCoreBlockWall().setRegistryName("warpcorewall"));
|
||||||
|
e.getRegistry().register(new WarpCoreBlockPort(WarpCoreBlockType.Power).setRegistryName("warpcorepower"));
|
||||||
|
e.getRegistry().register(new WarpCoreBlockPort(WarpCoreBlockType.Input).setRegistryName("warpcoreinput"));
|
||||||
|
e.getRegistry().register(new WarpCoreBlockPort(WarpCoreBlockType.Output).setRegistryName("warpcoreoutput"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onItemRegistry(final RegistryEvent.Register<Item> e) {
|
public static void onItemRegistry(final RegistryEvent.Register<Item> e) {
|
||||||
e.getRegistry().register(new BlockItem(Blocks.WCORESTRUCT, ItemProperties.BlockItemProperties).setRegistryName("wcoreextern"));
|
e.getRegistry().register(new BlockItem(Blocks.WCORESTRUCT, ItemProperties.BlockItemProperties).setRegistryName("wcoreextern"));
|
||||||
|
e.getRegistry().register(new BlockItem(Blocks.WCOREWALL, ItemProperties.BlockItemProperties).setRegistryName("warpcorewall"));
|
||||||
|
e.getRegistry().register(new BlockItem(Blocks.WCOREPOWER, ItemProperties.BlockItemProperties).setRegistryName("warpcorepower"));
|
||||||
|
e.getRegistry().register(new BlockItem(Blocks.WCOREINPUT, ItemProperties.BlockItemProperties).setRegistryName("warpcoreinput"));
|
||||||
|
e.getRegistry().register(new BlockItem(Blocks.WCOREOUTPUT, ItemProperties.BlockItemProperties).setRegistryName("warpcoreoutput"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onTileRegistry(final RegistryEvent.Register<TileEntityType<?>> e) {
|
||||||
|
e.getRegistry().registerAll(TileEntityType.Builder.create(() -> new WarpCoreTileEntity(EngageTETypes.WarpCoreBaseType), Blocks.WCOREWALL).build(null).setRegistryName("warpcorebase"),
|
||||||
|
TileEntityType.Builder.create(() -> new WarpCorePowerTileEntity(EngageTETypes.WarpCorePowerType), Blocks.WCOREPOWER).build(null).setRegistryName("warpcorepower"),
|
||||||
|
TileEntityType.Builder.create(() -> new WarpCoreTileEntity(EngageTETypes.WarpCorePortType), Blocks.WCOREINPUT, Blocks.WCOREOUTPUT).build(null).setRegistryName("warpcoreport"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package uk.gemwire.engage.multiblocks.bts;
|
package uk.gemwire.engage.api.multiblocks.bts;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.state.BooleanProperty;
|
import net.minecraft.state.BooleanProperty;
|
|
@ -1,4 +1,4 @@
|
||||||
package uk.gemwire.engage.multiblocks.bts;
|
package uk.gemwire.engage.api.multiblocks.bts;
|
||||||
|
|
||||||
import net.minecraft.state.EnumProperty;
|
import net.minecraft.state.EnumProperty;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
|
@ -1,10 +1,10 @@
|
||||||
package uk.gemwire.engage.multiblocks.bts;
|
package uk.gemwire.engage.api.multiblocks.bts;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import uk.gemwire.engage.Engage;
|
import uk.gemwire.engage.Engage;
|
||||||
import uk.gemwire.engage.multiblocks.iface.IMultiblockPart;
|
import uk.gemwire.engage.api.multiblocks.iface.IMultiblockPart;
|
||||||
import uk.gemwire.engage.multiblocks.iface.IMultiblockRegistry;
|
import uk.gemwire.engage.api.multiblocks.iface.IMultiblockRegistry;
|
||||||
import uk.gemwire.engage.multiblocks.te.MultiblockControllerBase;
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package uk.gemwire.engage.multiblocks.bts;
|
package uk.gemwire.engage.api.multiblocks.bts;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -6,9 +6,9 @@ import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.AbstractChunkProvider;
|
import net.minecraft.world.chunk.AbstractChunkProvider;
|
||||||
import uk.gemwire.engage.Engage;
|
import uk.gemwire.engage.Engage;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.iface.IMultiblockPart;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
import uk.gemwire.engage.misc.Helper;
|
import uk.gemwire.engage.misc.Helper;
|
||||||
import uk.gemwire.engage.multiblocks.iface.IMultiblockPart;
|
|
||||||
import uk.gemwire.engage.multiblocks.te.MultiblockControllerBase;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package uk.gemwire.engage.multiblocks.bts;
|
package uk.gemwire.engage.api.multiblocks.bts;
|
||||||
|
|
||||||
import net.minecraft.state.EnumProperty;
|
import net.minecraft.state.EnumProperty;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
|
@ -1,8 +1,8 @@
|
||||||
package uk.gemwire.engage.multiblocks.iface;
|
package uk.gemwire.engage.api.multiblocks.iface;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import uk.gemwire.engage.multiblocks.te.MultiblockControllerBase;
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package uk.gemwire.engage.multiblocks.iface;
|
package uk.gemwire.engage.api.multiblocks.iface;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import uk.gemwire.engage.multiblocks.te.MultiblockControllerBase;
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
|
|
||||||
public interface IMultiblockRegistry {
|
public interface IMultiblockRegistry {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package uk.gemwire.engage.multiblocks.te;
|
package uk.gemwire.engage.api.multiblocks.te;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
@ -10,13 +10,13 @@ import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import uk.gemwire.engage.Engage;
|
import uk.gemwire.engage.Engage;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.bts.MultiblockRegistry;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.iface.IMultiblockPart;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.iface.IMultiblockRegistry;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.validation.IMultiblockValidator;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.validation.ValidationError;
|
||||||
import uk.gemwire.engage.blocks.ModTileEntity;
|
import uk.gemwire.engage.blocks.ModTileEntity;
|
||||||
import uk.gemwire.engage.misc.Helper;
|
import uk.gemwire.engage.misc.Helper;
|
||||||
import uk.gemwire.engage.multiblocks.bts.MultiblockRegistry;
|
|
||||||
import uk.gemwire.engage.multiblocks.iface.IMultiblockPart;
|
|
||||||
import uk.gemwire.engage.multiblocks.iface.IMultiblockRegistry;
|
|
||||||
import uk.gemwire.engage.multiblocks.validation.IMultiblockValidator;
|
|
||||||
import uk.gemwire.engage.multiblocks.validation.ValidationError;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
|
@ -1,4 +1,4 @@
|
||||||
package uk.gemwire.engage.multiblocks.te;
|
package uk.gemwire.engage.api.multiblocks.te;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -6,9 +6,9 @@ import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import uk.gemwire.engage.Engage;
|
import uk.gemwire.engage.Engage;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.bts.MultiblockRegistry;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.iface.IMultiblockPart;
|
||||||
import uk.gemwire.engage.blocks.ModTileEntity;
|
import uk.gemwire.engage.blocks.ModTileEntity;
|
||||||
import uk.gemwire.engage.multiblocks.bts.MultiblockRegistry;
|
|
||||||
import uk.gemwire.engage.multiblocks.iface.IMultiblockPart;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
|
@ -1,11 +1,11 @@
|
||||||
package uk.gemwire.engage.multiblocks.te.rectangular;
|
package uk.gemwire.engage.api.multiblocks.te.rectangular;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import uk.gemwire.engage.multiblocks.te.MultiblockControllerBase;
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
import uk.gemwire.engage.multiblocks.validation.IMultiblockValidator;
|
import uk.gemwire.engage.api.multiblocks.validation.IMultiblockValidator;
|
||||||
import uk.gemwire.engage.multiblocks.validation.ValidationError;
|
import uk.gemwire.engage.api.multiblocks.validation.ValidationError;
|
||||||
|
|
||||||
public abstract class RectangularMultiblockControllerBase extends MultiblockControllerBase {
|
public abstract class RectangularMultiblockControllerBase extends MultiblockControllerBase {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package uk.gemwire.engage.multiblocks.te.rectangular;
|
package uk.gemwire.engage.api.multiblocks.te.rectangular;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import uk.gemwire.engage.multiblocks.bts.BlockFacing;
|
import uk.gemwire.engage.api.multiblocks.bts.BlockFacing;
|
||||||
import uk.gemwire.engage.multiblocks.bts.PartPosition;
|
import uk.gemwire.engage.api.multiblocks.bts.PartPosition;
|
||||||
import uk.gemwire.engage.multiblocks.te.MultiblockControllerBase;
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
import uk.gemwire.engage.multiblocks.te.MultiblockTileEntityBase;
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockTileEntityBase;
|
||||||
import uk.gemwire.engage.multiblocks.validation.IMultiblockValidator;
|
import uk.gemwire.engage.api.multiblocks.validation.IMultiblockValidator;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
|
@ -1,4 +1,4 @@
|
||||||
package uk.gemwire.engage.multiblocks.validation;
|
package uk.gemwire.engage.api.multiblocks.validation;
|
||||||
|
|
||||||
|
|
||||||
public interface IMultiblockValidator {
|
public interface IMultiblockValidator {
|
|
@ -1,4 +1,4 @@
|
||||||
package uk.gemwire.engage.multiblocks.validation;
|
package uk.gemwire.engage.api.multiblocks.validation;
|
||||||
|
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TranslationTextComponent;
|
import net.minecraft.util.text.TranslationTextComponent;
|
|
@ -2,10 +2,26 @@ package uk.gemwire.engage.blocks;
|
||||||
|
|
||||||
import net.minecraftforge.registries.ObjectHolder;
|
import net.minecraftforge.registries.ObjectHolder;
|
||||||
import uk.gemwire.engage.blocks.util.WCoreStruct;
|
import uk.gemwire.engage.blocks.util.WCoreStruct;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.block.WarpCoreBlockPort;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.block.WarpCoreBlockWall;
|
||||||
|
|
||||||
public class Blocks {
|
public class Blocks {
|
||||||
|
|
||||||
@ObjectHolder("engage:wcoreextern")
|
@ObjectHolder("engage:wcoreextern")
|
||||||
public static WCoreStruct WCORESTRUCT;
|
public static WCoreStruct WCORESTRUCT;
|
||||||
|
|
||||||
|
@ObjectHolder("engage:warpcorewall")
|
||||||
|
public static WarpCoreBlockWall WCOREWALL;
|
||||||
|
|
||||||
|
@ObjectHolder("engage:warpcorepower")
|
||||||
|
public static WarpCoreBlockPort WCOREPOWER;
|
||||||
|
|
||||||
|
@ObjectHolder("engage:warpcoreinput")
|
||||||
|
public static WarpCoreBlockPort WCOREINPUT;
|
||||||
|
|
||||||
|
@ObjectHolder("engage:warpcoreoutput")
|
||||||
|
public static WarpCoreBlockPort WCOREOUTPUT;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package uk.gemwire.engage.blocks.tileEntities;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
import net.minecraftforge.registries.ObjectHolder;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCoreIOPortTileEntity;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCorePowerTileEntity;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCoreTileEntity;
|
||||||
|
|
||||||
|
public class EngageTETypes {
|
||||||
|
|
||||||
|
@ObjectHolder("engage:warpcorebase")
|
||||||
|
public static TileEntityType<WarpCoreTileEntity> WarpCoreBaseType;
|
||||||
|
|
||||||
|
@ObjectHolder("engage:warpcorepower")
|
||||||
|
public static TileEntityType<WarpCorePowerTileEntity> WarpCorePowerType;
|
||||||
|
|
||||||
|
@ObjectHolder("engage:warpcoreport")
|
||||||
|
public static TileEntityType<WarpCoreIOPortTileEntity> WarpCorePortType;
|
||||||
|
}
|
|
@ -0,0 +1,289 @@
|
||||||
|
package uk.gemwire.engage.multiblock.warpcore;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.iface.IMultiblockPart;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.te.rectangular.RectangularMultiblockControllerBase;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.validation.IMultiblockValidator;
|
||||||
|
import uk.gemwire.engage.blocks.ModTileEntity;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCoreIOPortTileEntity;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCorePowerTileEntity;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCoreTileEntity;
|
||||||
|
|
||||||
|
public class WarpCoreController extends RectangularMultiblockControllerBase {
|
||||||
|
|
||||||
|
private static final int MACHINE_SIZE = 3;
|
||||||
|
|
||||||
|
private WarpCoreIOPortTileEntity inputPort;
|
||||||
|
private WarpCoreIOPortTileEntity outputPort;
|
||||||
|
private WarpCorePowerTileEntity powerPort;
|
||||||
|
private boolean active;
|
||||||
|
|
||||||
|
public WarpCoreController(World world) {
|
||||||
|
super(world);
|
||||||
|
|
||||||
|
this.inputPort = this.outputPort = null;
|
||||||
|
this.powerPort = null;
|
||||||
|
this.active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleActive() {
|
||||||
|
this.setActive(!this.active);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
|
||||||
|
if (this.active == active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.active = active;
|
||||||
|
|
||||||
|
if (!this.WORLD.isRemote) {
|
||||||
|
this.markReferenceCoordForUpdate();
|
||||||
|
this.markReferenceCoordDirty();
|
||||||
|
} else
|
||||||
|
this.markMultiblockForRenderUpdate();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isBlockGoodForFrame(World world, int x, int y, int z, IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.invalid_block", x, y, z);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isBlockGoodForBottom(World world, int x, int y, int z, IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.invalid_block", x, y, z);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isBlockGoodForInterior(World world, int x, int y, int z, IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.invalid_block", x, y, z);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isBlockGoodForSides(World world, int x, int y, int z, IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.invalid_block", x, y, z);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isBlockGoodForTop(World world, int x, int y, int z, IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.invalid_block", x, y, z);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBlockAdded(IMultiblockPart part) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBlockRemoved(IMultiblockPart part) {
|
||||||
|
if (part instanceof WarpCoreTileEntity) {
|
||||||
|
WarpCoreTileEntity tile = (WarpCoreTileEntity) part;
|
||||||
|
|
||||||
|
if (tile == this.powerPort)
|
||||||
|
this.powerPort = null;
|
||||||
|
} else if (part instanceof WarpCoreIOPortTileEntity) {
|
||||||
|
WarpCoreIOPortTileEntity tile = (WarpCoreIOPortTileEntity) part;
|
||||||
|
|
||||||
|
if (tile == this.outputPort) {
|
||||||
|
this.outputPort = null;
|
||||||
|
} else if (tile == this.inputPort) {
|
||||||
|
this.inputPort = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isMachineWhole(IMultiblockValidator validatorCallback) {
|
||||||
|
WarpCorePowerTileEntity powerPort = null;
|
||||||
|
WarpCoreIOPortTileEntity inputPort = null;
|
||||||
|
WarpCoreIOPortTileEntity outputPort = null;
|
||||||
|
|
||||||
|
if (!super.isMachineWhole(validatorCallback))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
for (IMultiblockPart part : this.connectedParts) {
|
||||||
|
if (part instanceof WarpCorePowerTileEntity) {
|
||||||
|
if (powerPort != null) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.powerport_already_present");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
powerPort = (WarpCorePowerTileEntity) part;
|
||||||
|
} else if (part instanceof WarpCoreIOPortTileEntity) {
|
||||||
|
WarpCoreIOPortTileEntity io = (WarpCoreIOPortTileEntity) part;
|
||||||
|
|
||||||
|
boolean isInput = io.isInput();
|
||||||
|
|
||||||
|
if (isInput) {
|
||||||
|
if (inputPort != null) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.inputport_already_present");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
inputPort = io;
|
||||||
|
} else {
|
||||||
|
if (outputPort != null) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.outputport_already_present");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
outputPort = io;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (powerPort == null) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.powerport_missing");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (inputPort == null) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.inputport_missing");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outputPort == null) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.outputport_missing");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMachineAssembled() {
|
||||||
|
this.lookupPorts();
|
||||||
|
|
||||||
|
if (this.WORLD.isRemote)
|
||||||
|
this.markMultiblockForRenderUpdate();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMachineRestored() {
|
||||||
|
this.onMachineAssembled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMachinePaused() {
|
||||||
|
if (this.WORLD.isRemote)
|
||||||
|
this.markMultiblockForRenderUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMachineDisassembled() {
|
||||||
|
if (this.WORLD.isRemote)
|
||||||
|
this.markMultiblockForRenderUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttachedPartWithMultiblockData(IMultiblockPart part, CompoundNBT data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAssimilate(MultiblockControllerBase assimilatedController) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAssimilated(MultiblockControllerBase asssimilatorController) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMinBlocksInFullMachine() {
|
||||||
|
return 27;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMaxXSize() {
|
||||||
|
return MACHINE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMaxYSize() {
|
||||||
|
return MACHINE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMaxZSize() {
|
||||||
|
return MACHINE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMinXSize() {
|
||||||
|
return MACHINE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMinYSize() {
|
||||||
|
return MACHINE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMinZSize() {
|
||||||
|
return MACHINE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean updateServer() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateClient() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void syncDataFrom(CompoundNBT data, ModTileEntity.SyncReason syncReason) {
|
||||||
|
if (data.contains("isActive"))
|
||||||
|
this.setActive(data.getBoolean("isActive"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void syncDataTo(CompoundNBT data, ModTileEntity.SyncReason syncReason) {
|
||||||
|
data.putBoolean("isActive", this.isActive());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lookupPorts() {
|
||||||
|
|
||||||
|
this.outputPort = null;
|
||||||
|
this.inputPort = null;
|
||||||
|
this.powerPort = null;
|
||||||
|
|
||||||
|
for (IMultiblockPart part : this.connectedParts) {
|
||||||
|
if (part instanceof WarpCorePowerTileEntity)
|
||||||
|
this.powerPort = (WarpCorePowerTileEntity) part;
|
||||||
|
|
||||||
|
if (part instanceof WarpCoreIOPortTileEntity) {
|
||||||
|
|
||||||
|
WarpCoreIOPortTileEntity io = (WarpCoreIOPortTileEntity) part;
|
||||||
|
|
||||||
|
if (io.isInput())
|
||||||
|
this.inputPort = io;
|
||||||
|
else
|
||||||
|
this.outputPort = io;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package uk.gemwire.engage.multiblock.warpcore.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.iface.IMultiblockPart;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.validation.ValidationError;
|
||||||
|
import uk.gemwire.engage.blocks.tileEntities.EngageTETypes;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.WarpCoreController;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCoreIOPortTileEntity;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCorePowerTileEntity;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.tile.WarpCoreTileEntity;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class WarpCoreBlockBase extends Block {
|
||||||
|
|
||||||
|
private WarpCoreBlockType myType;
|
||||||
|
|
||||||
|
protected WarpCoreBlockBase(WarpCoreBlockType blockType) {
|
||||||
|
super(Properties.create(Material.IRON).hardnessAndResistance(1.5F, 10.0F).sound(SoundType.METAL));
|
||||||
|
|
||||||
|
this.myType = blockType;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasTileEntity(BlockState state) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
switch(this.myType) {
|
||||||
|
default:
|
||||||
|
return new WarpCoreTileEntity(EngageTETypes.WarpCoreBaseType);
|
||||||
|
case Power:
|
||||||
|
return new WarpCorePowerTileEntity(EngageTETypes.WarpCorePowerType);
|
||||||
|
case Input:
|
||||||
|
return new WarpCoreIOPortTileEntity(EngageTETypes.WarpCorePortType, true);
|
||||||
|
case Output:
|
||||||
|
return new WarpCoreIOPortTileEntity(EngageTETypes.WarpCorePortType, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult ray) {
|
||||||
|
if(world.isRemote || (hand != Hand.OFF_HAND || (player.getHeldItem(hand) == ItemStack.EMPTY)))
|
||||||
|
return ActionResultType.FAIL;
|
||||||
|
|
||||||
|
WarpCoreController controller = this.getWarpController(world, pos);
|
||||||
|
|
||||||
|
if(controller != null) {
|
||||||
|
if(player.isCrouching()) {
|
||||||
|
controller.toggleActive();
|
||||||
|
return ActionResultType.SUCCESS;
|
||||||
|
} else {
|
||||||
|
ValidationError status = controller.getLastError();
|
||||||
|
|
||||||
|
if(status != null) {
|
||||||
|
player.sendMessage(status.getChatMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ActionResultType.FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IMultiblockPart getMultiblockPartAt(World world, BlockPos pos) {
|
||||||
|
TileEntity te = world.getTileEntity(pos);
|
||||||
|
|
||||||
|
return te instanceof IMultiblockPart ? (IMultiblockPart) te : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WarpCoreController getWarpController(World world, BlockPos pos) {
|
||||||
|
MultiblockControllerBase controller = this.getMultiblockPartAt(world, pos).getMultiblockController();
|
||||||
|
|
||||||
|
return controller instanceof WarpCoreController ? (WarpCoreController) controller : null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package uk.gemwire.engage.multiblock.warpcore.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.BlockItemUseContext;
|
||||||
|
import net.minecraft.state.BooleanProperty;
|
||||||
|
import net.minecraft.state.DirectionProperty;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class WarpCoreBlockPort extends WarpCoreBlockBase {
|
||||||
|
|
||||||
|
public static final BooleanProperty ASSEMBLED = BooleanProperty.create("assembled");
|
||||||
|
public static final DirectionProperty HFACING = DirectionProperty.create("hfacing", Direction.Plane.HORIZONTAL);
|
||||||
|
|
||||||
|
public WarpCoreBlockPort(WarpCoreBlockType type) {
|
||||||
|
super(type);
|
||||||
|
|
||||||
|
if(type == WarpCoreBlockType.Wall)
|
||||||
|
throw new IllegalArgumentException("Invalid port type on warp core!");
|
||||||
|
|
||||||
|
this.setDefaultState(this.getDefaultState().with(HFACING, Direction.NORTH).with(ASSEMBLED, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getStateForPlacement(BlockItemUseContext c) {
|
||||||
|
PlayerEntity player = c.getPlayer();
|
||||||
|
Direction facing = (player != null) ? player.getHorizontalFacing().getOpposite() : Direction.NORTH;
|
||||||
|
|
||||||
|
return this.getDefaultState().with(HFACING, facing);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState newstate, boolean moving) {
|
||||||
|
Direction dir = this.suggestDefaultFacing(world, pos, state.get(HFACING));
|
||||||
|
world.setBlockState(pos, state.with(HFACING, dir), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Direction suggestDefaultFacing(World world, BlockPos pos, Direction currentDir) {
|
||||||
|
|
||||||
|
Direction oppositeDir = currentDir.getOpposite();
|
||||||
|
BlockState facingBlockState = world.getBlockState(pos.offset(currentDir));
|
||||||
|
BlockState oppositeBlockState = world.getBlockState(pos.offset(oppositeDir));
|
||||||
|
|
||||||
|
return facingBlockState.isSolid() && !oppositeBlockState.isSolid() ? oppositeDir : currentDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
IMultiblockPart part = this.getMultiblockPartAt(world.getWorld(), pos1);
|
||||||
|
|
||||||
|
if(part instanceof WarpCoreTileEntity) {
|
||||||
|
WarpCoreTileEntity wallTile = (WarpCoreTileEntity) part;
|
||||||
|
|
||||||
|
boolean assembled = wallTile.isConnected() && wallTile.getMultiblockController().isAssembled();
|
||||||
|
|
||||||
|
state = state.with(ASSEMBLED, assembled);
|
||||||
|
|
||||||
|
if(assembled) {
|
||||||
|
switch(wallTile.getPartPosition()) {
|
||||||
|
case NorthFace:
|
||||||
|
state = state.with(HFACING, Direction.NORTH);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SouthFace:
|
||||||
|
state = state.with(HFACING, Direction.SOUTH);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WestFace:
|
||||||
|
state = state.with(HFACING, Direction.WEST);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EastFace:
|
||||||
|
state = state.with(HFACING, Direction.EAST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package uk.gemwire.engage.multiblock.warpcore.block;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
|
public enum WarpCoreBlockType implements IStringSerializable {
|
||||||
|
|
||||||
|
Wall,
|
||||||
|
Power,
|
||||||
|
Input,
|
||||||
|
Output;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return super.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package uk.gemwire.engage.multiblock.warpcore.block;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import net.minecraft.state.EnumProperty;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.bts.BlockFacingProperty;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class WarpCoreBlockWall extends WarpCoreBlockBase {
|
||||||
|
|
||||||
|
private final static EnumProperty FACES;
|
||||||
|
|
||||||
|
|
||||||
|
public WarpCoreBlockWall() {
|
||||||
|
super(WarpCoreBlockType.Wall);
|
||||||
|
this.setDefaultState(this.getDefaultState().with(FACES, BlockFacingProperty.All));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static {
|
||||||
|
|
||||||
|
ArrayList<BlockFacingProperty> values = Lists.newArrayList();
|
||||||
|
|
||||||
|
values.addAll(BlockFacingProperty.ALL_AND_NONE);
|
||||||
|
values.addAll(BlockFacingProperty.FACES);
|
||||||
|
values.addAll(BlockFacingProperty.ANGLES);
|
||||||
|
values.addAll(BlockFacingProperty.CORNERS);
|
||||||
|
values.add(BlockFacingProperty.Opposite_EW);
|
||||||
|
|
||||||
|
FACES = EnumProperty.create("faces", BlockFacingProperty.class, values);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package uk.gemwire.engage.multiblock.warpcore.tile;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.validation.IMultiblockValidator;
|
||||||
|
|
||||||
|
public class WarpCoreIOPortTileEntity extends WarpCoreTileEntity {
|
||||||
|
|
||||||
|
protected boolean isInput;
|
||||||
|
|
||||||
|
public WarpCoreIOPortTileEntity(TileEntityType type, boolean isInput) {
|
||||||
|
super(type);
|
||||||
|
isInput = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WarpCoreIOPortTileEntity(TileEntityType type) {
|
||||||
|
this(type, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForTop(IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.ioport_invalid_position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForBottom(IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.ioport_invalid_position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForFrame(IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.ioport_invalid_position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForInterior(IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.ioport_invalid_position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInput() {
|
||||||
|
return isInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void syncDataFrom(CompoundNBT data, SyncReason reason) {
|
||||||
|
super.syncDataFrom(data, reason);
|
||||||
|
|
||||||
|
if(data.contains("IODir"))
|
||||||
|
this.isInput = data.getBoolean("IODir");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void syncDataTo(CompoundNBT data, SyncReason reason) {
|
||||||
|
super.syncDataTo(data, reason);
|
||||||
|
|
||||||
|
data.putBoolean("IODir", this.isInput);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package uk.gemwire.engage.multiblock.warpcore.tile;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.validation.IMultiblockValidator;
|
||||||
|
|
||||||
|
public class WarpCorePowerTileEntity extends WarpCoreTileEntity {
|
||||||
|
|
||||||
|
public WarpCorePowerTileEntity(TileEntityType type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForInterior(IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.powerport_invalid_position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForTop(IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.powerport_invalid_position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForBottom(IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.powerport_invalid_position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForFrame(IMultiblockValidator validatorCallback) {
|
||||||
|
validatorCallback.setLastError("engage:multiblock.error.powerport_invalid_position");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package uk.gemwire.engage.multiblock.warpcore.tile;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.te.MultiblockControllerBase;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.te.rectangular.RectangularMultiblockTileEntityBase;
|
||||||
|
import uk.gemwire.engage.api.multiblocks.validation.IMultiblockValidator;
|
||||||
|
import uk.gemwire.engage.multiblock.warpcore.WarpCoreController;
|
||||||
|
|
||||||
|
public class WarpCoreTileEntity extends RectangularMultiblockTileEntityBase {
|
||||||
|
|
||||||
|
public WarpCoreTileEntity(TileEntityType type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForSides(IMultiblockValidator validatorCallback) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForFrame(IMultiblockValidator validatorCallback) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForTop(IMultiblockValidator validatorCallback) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForBottom(IMultiblockValidator validatorCallback) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoodForInterior(IMultiblockValidator validatorCallback) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMachineActivated() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMachineDeactivated() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MultiblockControllerBase createNewMultiblock() {
|
||||||
|
return new WarpCoreController(this.world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends MultiblockControllerBase> getMultiblockControllerType() {
|
||||||
|
return WarpCoreController.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WarpCoreController getCoreController() {
|
||||||
|
return (WarpCoreController)this.getMultiblockController();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user