feat: implement duplicator
|
@ -52,7 +52,7 @@ BreakBeforeTernaryOperators: true
|
||||||
BreakConstructorInitializers: AfterColon
|
BreakConstructorInitializers: AfterColon
|
||||||
BreakInheritanceList: AfterColon
|
BreakInheritanceList: AfterColon
|
||||||
BreakStringLiterals: true
|
BreakStringLiterals: true
|
||||||
ColumnLimit: 90
|
ColumnLimit: 100
|
||||||
CompactNamespaces: false
|
CompactNamespaces: false
|
||||||
ConstructorInitializerIndentWidth: 4
|
ConstructorInitializerIndentWidth: 4
|
||||||
ContinuationIndentWidth: 4
|
ContinuationIndentWidth: 4
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.anvilcraft.thaummach.gui.GuiArcaneFurnace;
|
||||||
import net.anvilcraft.thaummach.gui.GuiBore;
|
import net.anvilcraft.thaummach.gui.GuiBore;
|
||||||
import net.anvilcraft.thaummach.gui.GuiCondenser;
|
import net.anvilcraft.thaummach.gui.GuiCondenser;
|
||||||
import net.anvilcraft.thaummach.gui.GuiCrystallizer;
|
import net.anvilcraft.thaummach.gui.GuiCrystallizer;
|
||||||
|
import net.anvilcraft.thaummach.gui.GuiDuplicator;
|
||||||
import net.anvilcraft.thaummach.gui.GuiGenerator;
|
import net.anvilcraft.thaummach.gui.GuiGenerator;
|
||||||
import net.anvilcraft.thaummach.gui.GuiRepairer;
|
import net.anvilcraft.thaummach.gui.GuiRepairer;
|
||||||
import net.anvilcraft.thaummach.gui.GuiSoulBrazier;
|
import net.anvilcraft.thaummach.gui.GuiSoulBrazier;
|
||||||
|
@ -20,6 +21,7 @@ import net.anvilcraft.thaummach.render.tile.TileBoreRenderer;
|
||||||
import net.anvilcraft.thaummach.render.tile.TileCondenserRenderer;
|
import net.anvilcraft.thaummach.render.tile.TileCondenserRenderer;
|
||||||
import net.anvilcraft.thaummach.render.tile.TileConduitPumpRenderer;
|
import net.anvilcraft.thaummach.render.tile.TileConduitPumpRenderer;
|
||||||
import net.anvilcraft.thaummach.render.tile.TileCrystallizerRenderer;
|
import net.anvilcraft.thaummach.render.tile.TileCrystallizerRenderer;
|
||||||
|
import net.anvilcraft.thaummach.render.tile.TileDuplicatorRenderer;
|
||||||
import net.anvilcraft.thaummach.render.tile.TileGeneratorRenderer;
|
import net.anvilcraft.thaummach.render.tile.TileGeneratorRenderer;
|
||||||
import net.anvilcraft.thaummach.render.tile.TileRepairerRenderer;
|
import net.anvilcraft.thaummach.render.tile.TileRepairerRenderer;
|
||||||
import net.anvilcraft.thaummach.render.tile.TileSealRenderer;
|
import net.anvilcraft.thaummach.render.tile.TileSealRenderer;
|
||||||
|
@ -35,6 +37,7 @@ import net.anvilcraft.thaummach.tiles.TileConduitValve;
|
||||||
import net.anvilcraft.thaummach.tiles.TileConduitValveAdvanced;
|
import net.anvilcraft.thaummach.tiles.TileConduitValveAdvanced;
|
||||||
import net.anvilcraft.thaummach.tiles.TileCrucible;
|
import net.anvilcraft.thaummach.tiles.TileCrucible;
|
||||||
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileDuplicator;
|
||||||
import net.anvilcraft.thaummach.tiles.TileFilter;
|
import net.anvilcraft.thaummach.tiles.TileFilter;
|
||||||
import net.anvilcraft.thaummach.tiles.TileGenerator;
|
import net.anvilcraft.thaummach.tiles.TileGenerator;
|
||||||
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
||||||
|
@ -77,6 +80,7 @@ public class ClientProxy extends CommonProxy {
|
||||||
ClientRegistry.registerTileEntity(TileCondenser.class, "condenser", new TileCondenserRenderer());
|
ClientRegistry.registerTileEntity(TileCondenser.class, "condenser", new TileCondenserRenderer());
|
||||||
ClientRegistry.registerTileEntity(TileConduitPump.class, "conduit_pump", new TileConduitPumpRenderer());
|
ClientRegistry.registerTileEntity(TileConduitPump.class, "conduit_pump", new TileConduitPumpRenderer());
|
||||||
ClientRegistry.registerTileEntity(TileCrystallizer.class, "crystallizer", new TileCrystallizerRenderer());
|
ClientRegistry.registerTileEntity(TileCrystallizer.class, "crystallizer", new TileCrystallizerRenderer());
|
||||||
|
ClientRegistry.registerTileEntity(TileDuplicator.class, "duplicator", new TileDuplicatorRenderer());
|
||||||
ClientRegistry.registerTileEntity(TileGenerator.class, "generator", new TileGeneratorRenderer());
|
ClientRegistry.registerTileEntity(TileGenerator.class, "generator", new TileGeneratorRenderer());
|
||||||
ClientRegistry.registerTileEntity(TileRepairer.class, "repairer", new TileRepairerRenderer());
|
ClientRegistry.registerTileEntity(TileRepairer.class, "repairer", new TileRepairerRenderer());
|
||||||
ClientRegistry.registerTileEntity(TileSeal.class, "seal", new TileSealRenderer());
|
ClientRegistry.registerTileEntity(TileSeal.class, "seal", new TileSealRenderer());
|
||||||
|
@ -102,6 +106,9 @@ public class ClientProxy extends CommonProxy {
|
||||||
case CRYSTALLIZER:
|
case CRYSTALLIZER:
|
||||||
return new GuiCrystallizer(player.inventory, (TileCrystallizer) te);
|
return new GuiCrystallizer(player.inventory, (TileCrystallizer) te);
|
||||||
|
|
||||||
|
case DUPLICATOR:
|
||||||
|
return new GuiDuplicator(player.inventory, (TileDuplicator) te);
|
||||||
|
|
||||||
case GENERATOR:
|
case GENERATOR:
|
||||||
return new GuiGenerator((TileGenerator) te);
|
return new GuiGenerator((TileGenerator) te);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import net.anvilcraft.thaummach.container.ContainerArcaneFurnace;
|
||||||
import net.anvilcraft.thaummach.container.ContainerBore;
|
import net.anvilcraft.thaummach.container.ContainerBore;
|
||||||
import net.anvilcraft.thaummach.container.ContainerCondenser;
|
import net.anvilcraft.thaummach.container.ContainerCondenser;
|
||||||
import net.anvilcraft.thaummach.container.ContainerCrystallizer;
|
import net.anvilcraft.thaummach.container.ContainerCrystallizer;
|
||||||
|
import net.anvilcraft.thaummach.container.ContainerDuplicator;
|
||||||
import net.anvilcraft.thaummach.container.ContainerRepairer;
|
import net.anvilcraft.thaummach.container.ContainerRepairer;
|
||||||
import net.anvilcraft.thaummach.container.ContainerSoulBrazier;
|
import net.anvilcraft.thaummach.container.ContainerSoulBrazier;
|
||||||
import net.anvilcraft.thaummach.container.ContainerVoidChest;
|
import net.anvilcraft.thaummach.container.ContainerVoidChest;
|
||||||
|
@ -20,6 +21,7 @@ import net.anvilcraft.thaummach.tiles.TileConduitValve;
|
||||||
import net.anvilcraft.thaummach.tiles.TileConduitValveAdvanced;
|
import net.anvilcraft.thaummach.tiles.TileConduitValveAdvanced;
|
||||||
import net.anvilcraft.thaummach.tiles.TileCrucible;
|
import net.anvilcraft.thaummach.tiles.TileCrucible;
|
||||||
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileDuplicator;
|
||||||
import net.anvilcraft.thaummach.tiles.TileFilter;
|
import net.anvilcraft.thaummach.tiles.TileFilter;
|
||||||
import net.anvilcraft.thaummach.tiles.TileGenerator;
|
import net.anvilcraft.thaummach.tiles.TileGenerator;
|
||||||
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
||||||
|
@ -50,6 +52,7 @@ public class CommonProxy implements IGuiHandler {
|
||||||
GameRegistry.registerTileEntity(TileConduitValveAdvanced.class, "conduit_valve_advanced");
|
GameRegistry.registerTileEntity(TileConduitValveAdvanced.class, "conduit_valve_advanced");
|
||||||
GameRegistry.registerTileEntity(TileCrucible.class, "crucible");
|
GameRegistry.registerTileEntity(TileCrucible.class, "crucible");
|
||||||
GameRegistry.registerTileEntity(TileCrystallizer.class, "crystallizer");
|
GameRegistry.registerTileEntity(TileCrystallizer.class, "crystallizer");
|
||||||
|
GameRegistry.registerTileEntity(TileDuplicator.class, "duplicator");
|
||||||
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
||||||
GameRegistry.registerTileEntity(TileGenerator.class, "generator");
|
GameRegistry.registerTileEntity(TileGenerator.class, "generator");
|
||||||
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
||||||
|
@ -80,6 +83,9 @@ public class CommonProxy implements IGuiHandler {
|
||||||
case CRYSTALLIZER:
|
case CRYSTALLIZER:
|
||||||
return new ContainerCrystallizer(player.inventory, (TileCrystallizer) te);
|
return new ContainerCrystallizer(player.inventory, (TileCrystallizer) te);
|
||||||
|
|
||||||
|
case DUPLICATOR:
|
||||||
|
return new ContainerDuplicator(player.inventory, (TileDuplicator) te);
|
||||||
|
|
||||||
case REPAIRER:
|
case REPAIRER:
|
||||||
return new ContainerRepairer(player.inventory, (TileRepairer) te);
|
return new ContainerRepairer(player.inventory, (TileRepairer) te);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ public enum GuiID {
|
||||||
BORE,
|
BORE,
|
||||||
CONDENSER,
|
CONDENSER,
|
||||||
CRYSTALLIZER,
|
CRYSTALLIZER,
|
||||||
|
DUPLICATOR,
|
||||||
GENERATOR,
|
GENERATOR,
|
||||||
REPAIRER,
|
REPAIRER,
|
||||||
SOUL_BRAZIER,
|
SOUL_BRAZIER,
|
||||||
|
|
|
@ -15,6 +15,8 @@ import net.anvilcraft.thaummach.entities.EntitySingularity;
|
||||||
import net.anvilcraft.thaummach.packets.IPacketFX;
|
import net.anvilcraft.thaummach.packets.IPacketFX;
|
||||||
import net.anvilcraft.thaummach.packets.PacketChangeVoidInterfaceChannel;
|
import net.anvilcraft.thaummach.packets.PacketChangeVoidInterfaceChannel;
|
||||||
import net.anvilcraft.thaummach.packets.PacketChangeVoidInterfaceContainerPage;
|
import net.anvilcraft.thaummach.packets.PacketChangeVoidInterfaceContainerPage;
|
||||||
|
import net.anvilcraft.thaummach.packets.PacketDuplicatorPress;
|
||||||
|
import net.anvilcraft.thaummach.packets.PacketDuplicatorSetRepeat;
|
||||||
import net.anvilcraft.thaummach.packets.PacketFXSparkle;
|
import net.anvilcraft.thaummach.packets.PacketFXSparkle;
|
||||||
import net.anvilcraft.thaummach.packets.PacketFXWisp;
|
import net.anvilcraft.thaummach.packets.PacketFXWisp;
|
||||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||||
|
@ -39,25 +41,14 @@ public class ThaumicMachinery {
|
||||||
public void preInit(FMLPreInitializationEvent ev) {
|
public void preInit(FMLPreInitializationEvent ev) {
|
||||||
channel = NetworkRegistry.INSTANCE.newSimpleChannel("thaummach");
|
channel = NetworkRegistry.INSTANCE.newSimpleChannel("thaummach");
|
||||||
int pktid = 0;
|
int pktid = 0;
|
||||||
channel.registerMessage(
|
// clang-format off
|
||||||
new PacketFXWisp.Handler(), PacketFXWisp.class, pktid++, Side.CLIENT
|
channel.registerMessage(new PacketChangeVoidInterfaceChannel.Handler(), PacketChangeVoidInterfaceChannel.class, pktid++, Side.SERVER);
|
||||||
);
|
channel.registerMessage(new PacketChangeVoidInterfaceContainerPage.Handler(), PacketChangeVoidInterfaceContainerPage.class, pktid++, Side.SERVER);
|
||||||
channel.registerMessage(
|
channel.registerMessage(new PacketDuplicatorPress.Handler(), PacketDuplicatorPress.class, pktid++, Side.CLIENT);
|
||||||
new PacketFXSparkle.Handler(), PacketFXSparkle.class, pktid++, Side.CLIENT
|
channel.registerMessage(new PacketDuplicatorSetRepeat.Handler(), PacketDuplicatorSetRepeat.class, pktid++, Side.SERVER);
|
||||||
);
|
channel.registerMessage(new PacketFXSparkle.Handler(), PacketFXSparkle.class, pktid++, Side.CLIENT);
|
||||||
channel.registerMessage(
|
channel.registerMessage(new PacketFXWisp.Handler(), PacketFXWisp.class, pktid++, Side.CLIENT);
|
||||||
new PacketChangeVoidInterfaceChannel.Handler(),
|
// clang-format on
|
||||||
PacketChangeVoidInterfaceChannel.class,
|
|
||||||
pktid++,
|
|
||||||
Side.SERVER
|
|
||||||
);
|
|
||||||
channel.registerMessage(
|
|
||||||
new PacketChangeVoidInterfaceContainerPage.Handler(),
|
|
||||||
PacketChangeVoidInterfaceContainerPage.class,
|
|
||||||
pktid++,
|
|
||||||
Side.SERVER
|
|
||||||
);
|
|
||||||
|
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
|
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
|
||||||
|
|
||||||
proxy.registerTileEntities();
|
proxy.registerTileEntities();
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Random;
|
||||||
|
|
||||||
import dev.tilera.auracore.api.HelperLocation;
|
import dev.tilera.auracore.api.HelperLocation;
|
||||||
import dev.tilera.auracore.client.FXSparkle;
|
import dev.tilera.auracore.client.FXSparkle;
|
||||||
import net.anvilcraft.thaummach.AuraUtils;
|
|
||||||
import net.anvilcraft.thaummach.render.BlockApparatusRenderer;
|
import net.anvilcraft.thaummach.render.BlockApparatusRenderer;
|
||||||
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
|
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
|
||||||
import net.anvilcraft.thaummach.render.apparatus.apparati.fragile.ConduitApparatusRenderer;
|
import net.anvilcraft.thaummach.render.apparatus.apparati.fragile.ConduitApparatusRenderer;
|
||||||
|
@ -125,9 +124,8 @@ public class BlockApparatusFragile extends BlockApparatus {
|
||||||
return ConduitPumpApparatusRenderer.INSTANCE;
|
return ConduitPumpApparatusRenderer.INSTANCE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
throw new IllegalArgumentException("ALEC");
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,8 +11,10 @@ import net.anvilcraft.thaummach.particles.FXWisp;
|
||||||
import net.anvilcraft.thaummach.render.BlockApparatusRenderer;
|
import net.anvilcraft.thaummach.render.BlockApparatusRenderer;
|
||||||
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
|
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
|
||||||
import net.anvilcraft.thaummach.render.apparatus.apparati.wood.CondenserApparatusRenderer;
|
import net.anvilcraft.thaummach.render.apparatus.apparati.wood.CondenserApparatusRenderer;
|
||||||
|
import net.anvilcraft.thaummach.render.apparatus.apparati.wood.DuplicatorApparatusRenderer;
|
||||||
import net.anvilcraft.thaummach.render.apparatus.apparati.wood.RepairerApparatusRenderer;
|
import net.anvilcraft.thaummach.render.apparatus.apparati.wood.RepairerApparatusRenderer;
|
||||||
import net.anvilcraft.thaummach.tiles.TileCondenser;
|
import net.anvilcraft.thaummach.tiles.TileCondenser;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileDuplicator;
|
||||||
import net.anvilcraft.thaummach.tiles.TileRepairer;
|
import net.anvilcraft.thaummach.tiles.TileRepairer;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -42,9 +44,9 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
public IIcon[] iconsDuskTotemSide;
|
public IIcon[] iconsDuskTotemSide;
|
||||||
|
|
||||||
public IIcon iconDuplicatorBottom;
|
public IIcon iconDuplicatorBottom;
|
||||||
|
public IIcon iconDuplicatorFront;
|
||||||
public IIcon iconDuplicatorInside;
|
public IIcon iconDuplicatorInside;
|
||||||
public IIcon iconDuplicatorSide;
|
public IIcon iconDuplicatorSide;
|
||||||
public IIcon iconDuplicatorTop;
|
|
||||||
|
|
||||||
public IIcon iconRestorerBottom;
|
public IIcon iconRestorerBottom;
|
||||||
public IIcon iconRestorerSide;
|
public IIcon iconRestorerSide;
|
||||||
|
@ -79,9 +81,9 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
.toArray(IIcon[] ::new);
|
.toArray(IIcon[] ::new);
|
||||||
|
|
||||||
this.iconDuplicatorBottom = reg.apply("duplicator_bottom");
|
this.iconDuplicatorBottom = reg.apply("duplicator_bottom");
|
||||||
this.iconDuplicatorSide = reg.apply("duplicator_side");
|
this.iconDuplicatorFront = reg.apply("duplicator_front");
|
||||||
this.iconDuplicatorInside = reg.apply("duplicator_inside");
|
this.iconDuplicatorInside = reg.apply("duplicator_inside");
|
||||||
this.iconDuplicatorTop = reg.apply("duplicator_top");
|
this.iconDuplicatorSide = reg.apply("duplicator_side");
|
||||||
|
|
||||||
this.iconRestorerBottom = reg.apply("restorer_bottom");
|
this.iconRestorerBottom = reg.apply("restorer_bottom");
|
||||||
this.iconRestorerSide = reg.apply("restorer_side");
|
this.iconRestorerSide = reg.apply("restorer_side");
|
||||||
|
@ -98,7 +100,11 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
case REPAIRER:
|
case REPAIRER:
|
||||||
return RepairerApparatusRenderer.INSTANCE;
|
return RepairerApparatusRenderer.INSTANCE;
|
||||||
|
|
||||||
|
case DUPLICATOR:
|
||||||
|
return DuplicatorApparatusRenderer.INSTANCE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
//throw new IllegalArgumentException("ALEC");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,11 +112,9 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List itemList) {
|
public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List itemList) {
|
||||||
itemList.add(new ItemStack(this, 1, 0));
|
IntStream.rangeClosed(0, 4)
|
||||||
itemList.add(new ItemStack(this, 1, 1));
|
.mapToObj((m) -> new ItemStack(this, 1, m))
|
||||||
itemList.add(new ItemStack(this, 1, 2));
|
.forEach(itemList::add);
|
||||||
itemList.add(new ItemStack(this, 1, 3));
|
|
||||||
itemList.add(new ItemStack(this, 1, 4));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,9 +128,9 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
case REPAIRER:
|
case REPAIRER:
|
||||||
return new TileRepairer();
|
return new TileRepairer();
|
||||||
|
|
||||||
//case DUPLICATOR:
|
case DUPLICATOR:
|
||||||
// return new TileDuplicator();
|
return new TileDuplicator();
|
||||||
//
|
|
||||||
//case REPAIRER:
|
//case REPAIRER:
|
||||||
// return new TileRepairer();
|
// return new TileRepairer();
|
||||||
|
|
||||||
|
@ -136,8 +140,7 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void
|
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||||
setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k) {
|
|
||||||
int md = iblockaccess.getBlockMetadata(i, j, k);
|
int md = iblockaccess.getBlockMetadata(i, j, k);
|
||||||
if (md == 0) {
|
if (md == 0) {
|
||||||
float w3 = 0.1875F;
|
float w3 = 0.1875F;
|
||||||
|
@ -153,12 +156,7 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
if (md == 0) {
|
if (md == 0) {
|
||||||
float w3 = 0.1875F;
|
float w3 = 0.1875F;
|
||||||
AxisAlignedBB.getBoundingBox(
|
AxisAlignedBB.getBoundingBox(
|
||||||
(double) w3,
|
(double) w3, 0.0, (double) w3, (double) (1.0F - w3), 1.0, (double) (1.0F - w3)
|
||||||
0.0,
|
|
||||||
(double) w3,
|
|
||||||
(double) (1.0F - w3),
|
|
||||||
1.0,
|
|
||||||
(double) (1.0F - w3)
|
|
||||||
);
|
);
|
||||||
} else if (md == 10) {
|
} else if (md == 10) {
|
||||||
AxisAlignedBB.getBoundingBox(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
|
AxisAlignedBB.getBoundingBox(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
|
||||||
|
@ -169,17 +167,15 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(
|
public void onBlockPlacedBy(
|
||||||
World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack
|
World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack
|
||||||
) {
|
) {
|
||||||
MetaVals md = MetaVals.get(world.getBlockMetadata(i, j, k));
|
MetaVals md = MetaVals.get(world.getBlockMetadata(x, y, z));
|
||||||
int l = MathHelper.floor_double(
|
|
||||||
(double) (entityliving.rotationYaw * 4.0F / 360.0F) + 0.5
|
|
||||||
)
|
|
||||||
& 3;
|
|
||||||
if (md == MetaVals.DUPLICATOR) {
|
if (md == MetaVals.DUPLICATOR) {
|
||||||
// TODO: duplicator
|
int l
|
||||||
//TileDuplicator td = (TileDuplicator) world.getBlockTileEntity(i, j, k);
|
= MathHelper.floor_double((double) (entityliving.rotationYaw * 4.0F / 360.0F) + 0.5)
|
||||||
//td.orientation = l;
|
& 3;
|
||||||
|
TileDuplicator td = (TileDuplicator) world.getTileEntity(x, y, z);
|
||||||
|
td.orientation = l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,34 +244,32 @@ public class BlockApparatusWood extends BlockApparatus {
|
||||||
MetaVals md = MetaVals.get(iblockaccess.getBlockMetadata(i, j, k));
|
MetaVals md = MetaVals.get(iblockaccess.getBlockMetadata(i, j, k));
|
||||||
if (md == MetaVals.CONDENSER) {
|
if (md == MetaVals.CONDENSER) {
|
||||||
return l <= 1 ? this.iconCondenserTop : this.iconCondenserSide;
|
return l <= 1 ? this.iconCondenserTop : this.iconCondenserSide;
|
||||||
}
|
} else if (md == MetaVals.DUPLICATOR) {
|
||||||
//else if (md == 1) {
|
if (l <= 1) {
|
||||||
// if (l <= 1) {
|
return this.iconDuplicatorBottom;
|
||||||
// return 70;
|
} else {
|
||||||
// } else {
|
TileEntity te = iblockaccess.getTileEntity(i, j, k);
|
||||||
// TileEntity te = iblockaccess.getBlockTileEntity(i, j, k);
|
if (te != null && te instanceof TileDuplicator) {
|
||||||
// if (te != null && te instanceof TileDuplicator) {
|
if (((TileDuplicator) te).orientation == 0 && l == 2) {
|
||||||
// if (((TileDuplicator) te).orientation == 0 && l == 2) {
|
return this.iconDuplicatorFront;
|
||||||
// return 71;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// if (((TileDuplicator) te).orientation == 1 && l == 5) {
|
if (((TileDuplicator) te).orientation == 1 && l == 5) {
|
||||||
// return 71;
|
return this.iconDuplicatorFront;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (((TileDuplicator) te).orientation == 2 && l == 3) {
|
if (((TileDuplicator) te).orientation == 2 && l == 3) {
|
||||||
// return 71;
|
return this.iconDuplicatorFront;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (((TileDuplicator) te).orientation == 3 && l == 4) {
|
if (((TileDuplicator) te).orientation == 3 && l == 4) {
|
||||||
// return 71;
|
return this.iconDuplicatorFront;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// return 72;
|
return this.iconDuplicatorSide;
|
||||||
// }
|
}
|
||||||
//}
|
} else if (md == MetaVals.REPAIRER) {
|
||||||
else if (md == MetaVals.REPAIRER) {
|
|
||||||
return l <= 1 ? this.iconRestorerTop : this.iconRestorerSide;
|
return l <= 1 ? this.iconRestorerTop : this.iconRestorerSide;
|
||||||
}
|
}
|
||||||
//else if (md == 3) {
|
//else if (md == 3) {
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
package net.anvilcraft.thaummach.container;
|
||||||
|
|
||||||
|
import net.anvilcraft.thaummach.OutputSlot;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileDuplicator;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class ContainerDuplicator extends Container {
|
||||||
|
private TileDuplicator duplicator;
|
||||||
|
|
||||||
|
public ContainerDuplicator(InventoryPlayer inventoryplayer, TileDuplicator tileEntity) {
|
||||||
|
this.duplicator = tileEntity;
|
||||||
|
this.addSlotToContainer(new Slot(tileEntity, 9, 23, 34));
|
||||||
|
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
|
for (j = 0; j < 3; ++j) {
|
||||||
|
for (k = 0; k < 3; ++k) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
new OutputSlot(tileEntity, k + j * 3, 90 + k * 18, 17 + j * 18)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = 0; j < 3; ++j) {
|
||||||
|
for (k = 0; k < 9; ++k) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
new Slot(inventoryplayer, k + j * 9 + 9, 8 + k * 18, 84 + j * 18)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = 0; j < 9; ++j) {
|
||||||
|
this.addSlotToContainer(new Slot(inventoryplayer, j, 8 + j * 18, 142));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateProgressBar(int i, int j) {
|
||||||
|
if (i == 0) {
|
||||||
|
this.duplicator.duplicatorCopyTime = (float) j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(EntityPlayer pl, int i) {
|
||||||
|
ItemStack itemstack = null;
|
||||||
|
Slot slot = (Slot) super.inventorySlots.get(i);
|
||||||
|
if (slot != null && slot.getHasStack()) {
|
||||||
|
ItemStack itemstack1 = slot.getStack();
|
||||||
|
itemstack = itemstack1.copy();
|
||||||
|
if (i < 11) {
|
||||||
|
if (!this.mergeItemStack(itemstack1, 11, 37, true)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (i >= 11 && i < 37) {
|
||||||
|
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (!this.mergeItemStack(itemstack1, 11, 37, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemstack1.stackSize == 0) {
|
||||||
|
slot.putStack((ItemStack) null);
|
||||||
|
} else {
|
||||||
|
slot.onSlotChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemstack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer pl) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
package net.anvilcraft.thaummach.gui;
|
||||||
|
|
||||||
|
import net.anvilcraft.thaummach.ThaumicMachinery;
|
||||||
|
import net.anvilcraft.thaummach.container.ContainerDuplicator;
|
||||||
|
import net.anvilcraft.thaummach.packets.PacketDuplicatorSetRepeat;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileDuplicator;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public class GuiDuplicator extends GuiContainer {
|
||||||
|
private TileDuplicator duplicatorInventory;
|
||||||
|
|
||||||
|
public GuiDuplicator(InventoryPlayer inventoryplayer, TileDuplicator tileEntity) {
|
||||||
|
super(new ContainerDuplicator(inventoryplayer, tileEntity));
|
||||||
|
this.duplicatorInventory = tileEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int alec1, int alec2) {
|
||||||
|
super.fontRendererObj.drawString("Duplicator", 8, 5, 0x404040);
|
||||||
|
super.fontRendererObj.drawString("Inventory", 8, super.ySize - 96 + 2, 0x404040);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerBackgroundLayer(float f, int qq, int ww) {
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
super.mc.renderEngine.bindTexture(
|
||||||
|
new ResourceLocation("thaummach", "textures/guis/duplicator.png")
|
||||||
|
);
|
||||||
|
int j = (super.width - super.xSize) / 2;
|
||||||
|
int k = (super.height - super.ySize) / 2;
|
||||||
|
this.drawTexturedModalRect(j, k, 0, 0, super.xSize, super.ySize);
|
||||||
|
int i1;
|
||||||
|
if (this.duplicatorInventory.isCooking()) {
|
||||||
|
i1 = this.duplicatorInventory.getCookProgressScaled(25);
|
||||||
|
this.drawTexturedModalRect(j + 54, k + 34, 176, 15, i1 + 1, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.duplicatorInventory.repeat) {
|
||||||
|
this.drawTexturedModalRect(j + 62, k + 48, 176, 0, 10, 10);
|
||||||
|
} else {
|
||||||
|
this.drawTexturedModalRect(j + 62, k + 48, 186, 0, 10, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.duplicatorInventory.boost > 0) {
|
||||||
|
i1 = this.duplicatorInventory.getBoostScaled();
|
||||||
|
this.drawTexturedModalRect(j + 157, k + 45 - i1, 208, 30 - i1, 7, i1);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||||
|
if (this.duplicatorInventory.getUpgrades()[0] >= 0) {
|
||||||
|
this.drawTexturedModalRect(
|
||||||
|
j + 152, k + 60, 16 * this.duplicatorInventory.getUpgrades()[0], 32, 16, 16
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int i, int j, int k) {
|
||||||
|
super.mouseClicked(i, j, k);
|
||||||
|
int sx = (super.width - super.xSize) / 2;
|
||||||
|
int sy = (super.height - super.ySize) / 2;
|
||||||
|
int k1 = i - (sx + 62);
|
||||||
|
int l1 = j - (sy + 48);
|
||||||
|
if (k1 >= 0 && l1 >= 0 && k1 < 10 && l1 <= 10) {
|
||||||
|
Minecraft.getMinecraft().getSoundHandler().playSound(
|
||||||
|
PositionedSoundRecord.func_147674_a(new ResourceLocation("random.orb"), 1.0f)
|
||||||
|
);
|
||||||
|
ThaumicMachinery.channel.sendToServer(new PacketDuplicatorSetRepeat(
|
||||||
|
this.duplicatorInventory.xCoord,
|
||||||
|
this.duplicatorInventory.yCoord,
|
||||||
|
this.duplicatorInventory.zCoord,
|
||||||
|
!this.duplicatorInventory.repeat
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
package net.anvilcraft.thaummach.packets;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.anvilcraft.thaummach.particles.FXWisp;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileDuplicator;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class PacketDuplicatorPress implements IMessage {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
|
||||||
|
public PacketDuplicatorPress() {}
|
||||||
|
|
||||||
|
public PacketDuplicatorPress(int x, int y, int z) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf) {
|
||||||
|
this.x = buf.readInt();
|
||||||
|
this.y = buf.readInt();
|
||||||
|
this.z = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf) {
|
||||||
|
buf.writeInt(this.x);
|
||||||
|
buf.writeInt(this.y);
|
||||||
|
buf.writeInt(this.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Handler implements IMessageHandler<PacketDuplicatorPress, IMessage> {
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(PacketDuplicatorPress msg, MessageContext ctx) {
|
||||||
|
World world = Minecraft.getMinecraft().theWorld;
|
||||||
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
|
if (te instanceof TileDuplicator) {
|
||||||
|
((TileDuplicator) te).doPress = true;
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().getSoundHandler().playSound(
|
||||||
|
PositionedSoundRecord.func_147675_a(
|
||||||
|
new ResourceLocation("thaummach", "stomp"), msg.x, msg.y, msg.z
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
int q = 50;
|
||||||
|
for (int a = 0; a < q; ++a) {
|
||||||
|
float xx = (float) msg.x + 0.5F
|
||||||
|
- (world.rand.nextFloat() - world.rand.nextFloat()) * 1.5F;
|
||||||
|
float yy = (float) msg.y + 0.5F
|
||||||
|
- (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
|
||||||
|
float zz = (float) msg.z + 0.5F
|
||||||
|
- (world.rand.nextFloat() - world.rand.nextFloat()) * 1.5F;
|
||||||
|
FXWisp ef = new FXWisp(
|
||||||
|
world,
|
||||||
|
(double) ((float) msg.x + 0.5F),
|
||||||
|
(double) ((float) msg.y + 0.5F),
|
||||||
|
(double) ((float) msg.z + 0.5F),
|
||||||
|
(double) xx,
|
||||||
|
(double) yy,
|
||||||
|
(double) zz,
|
||||||
|
0.15F,
|
||||||
|
world.rand.nextInt(5)
|
||||||
|
);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package net.anvilcraft.thaummach.packets;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileDuplicator;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class PacketDuplicatorSetRepeat implements IMessage {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
boolean repeat;
|
||||||
|
|
||||||
|
public PacketDuplicatorSetRepeat() {}
|
||||||
|
|
||||||
|
public PacketDuplicatorSetRepeat(int x, int y, int z, boolean repeat) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.repeat = repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf) {
|
||||||
|
this.x = buf.readInt();
|
||||||
|
this.y = buf.readInt();
|
||||||
|
this.z = buf.readInt();
|
||||||
|
this.repeat = buf.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf) {
|
||||||
|
buf.writeInt(this.x);
|
||||||
|
buf.writeInt(this.y);
|
||||||
|
buf.writeInt(this.z);
|
||||||
|
buf.writeBoolean(this.repeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Handler implements IMessageHandler<PacketDuplicatorSetRepeat, IMessage> {
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(PacketDuplicatorSetRepeat msg, MessageContext ctx) {
|
||||||
|
World world = ctx.getServerHandler().playerEntity.worldObj;
|
||||||
|
|
||||||
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
|
|
||||||
|
if (te instanceof TileDuplicator) {
|
||||||
|
((TileDuplicator) te).repeat = msg.repeat;
|
||||||
|
world.markBlockForUpdate(msg.x, msg.y, msg.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
package net.anvilcraft.thaummach.render.apparatus.apparati.wood;
|
||||||
|
|
||||||
|
import net.anvilcraft.thaummach.TMBlocks;
|
||||||
|
import net.anvilcraft.thaummach.blocks.BlockApparatusMetal;
|
||||||
|
import net.anvilcraft.thaummach.blocks.BlockApparatusWood;
|
||||||
|
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import thaumcraft.client.renderers.block.BlockRenderer;
|
||||||
|
|
||||||
|
public class DuplicatorApparatusRenderer implements IApparatusRenderer {
|
||||||
|
public static final DuplicatorApparatusRenderer INSTANCE = new DuplicatorApparatusRenderer();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderApparatus(
|
||||||
|
IBlockAccess w, RenderBlocks rb, int x, int y, int z, Block block_, int meta, boolean inv
|
||||||
|
) {
|
||||||
|
BlockApparatusWood block = (BlockApparatusWood) block_;
|
||||||
|
float w3 = 0.1775F;
|
||||||
|
rb.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
if (inv) {
|
||||||
|
BlockRenderer.drawFaces(
|
||||||
|
rb,
|
||||||
|
block,
|
||||||
|
block.iconDuplicatorBottom,
|
||||||
|
block.iconDuplicatorBottom,
|
||||||
|
block.iconDuplicatorSide,
|
||||||
|
block.iconDuplicatorSide,
|
||||||
|
block.iconDuplicatorSide,
|
||||||
|
block.iconDuplicatorFront,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
rb.renderStandardBlock(block, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inv) {
|
||||||
|
rb.renderFaceYPos(
|
||||||
|
block,
|
||||||
|
(double) x,
|
||||||
|
(double) ((float) y - 1.0F + w3),
|
||||||
|
(double) z,
|
||||||
|
block.iconDuplicatorInside
|
||||||
|
);
|
||||||
|
rb.renderFaceXPos(
|
||||||
|
block,
|
||||||
|
(double) ((float) (x - 1) + w3),
|
||||||
|
(double) y,
|
||||||
|
(double) z,
|
||||||
|
block.iconDuplicatorInside
|
||||||
|
);
|
||||||
|
rb.renderFaceXNeg(
|
||||||
|
block,
|
||||||
|
(double) ((float) (x + 1) - w3),
|
||||||
|
(double) y,
|
||||||
|
(double) z,
|
||||||
|
block.iconDuplicatorInside
|
||||||
|
);
|
||||||
|
rb.renderFaceZPos(
|
||||||
|
block,
|
||||||
|
(double) x,
|
||||||
|
(double) y,
|
||||||
|
(double) ((float) (z - 1) + w3),
|
||||||
|
block.iconDuplicatorInside
|
||||||
|
);
|
||||||
|
rb.renderFaceZNeg(
|
||||||
|
block,
|
||||||
|
(double) x,
|
||||||
|
(double) y,
|
||||||
|
(double) ((float) (z + 1) - w3),
|
||||||
|
block.iconDuplicatorInside
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
rb.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.99F, 0.9F);
|
||||||
|
BlockRenderer.drawFaces(
|
||||||
|
rb,
|
||||||
|
block,
|
||||||
|
((BlockApparatusMetal) TMBlocks.apparatusMetal).iconArcaneFurnaceInside,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
rb.overrideBlockTexture = null;
|
||||||
|
rb.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package net.anvilcraft.thaummach.render.model;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
public class ModelDuplicator extends ModelBase {
|
||||||
|
ModelRenderer press1;
|
||||||
|
ModelRenderer piston1;
|
||||||
|
|
||||||
|
public ModelDuplicator() {
|
||||||
|
super.textureWidth = 64;
|
||||||
|
super.textureHeight = 32;
|
||||||
|
this.press1 = new ModelRenderer(this, 0, 0);
|
||||||
|
this.press1.addBox(-4.0F, 0.0F, -4.0F, 8, 4, 8);
|
||||||
|
this.press1.setRotationPoint(0.0F, 12.0F, 0.0F);
|
||||||
|
this.press1.setTextureSize(64, 32);
|
||||||
|
this.press1.mirror = true;
|
||||||
|
this.setRotation(this.press1, 0.0F, 0.0F, 0.0F);
|
||||||
|
this.piston1 = new ModelRenderer(this, 0, 12);
|
||||||
|
this.piston1.addBox(-2.0F, 0.0F, -2.0F, 4, 4, 4);
|
||||||
|
this.piston1.setRotationPoint(0.0F, 8.0F, 0.0F);
|
||||||
|
this.piston1.setTextureSize(64, 32);
|
||||||
|
this.piston1.mirror = true;
|
||||||
|
this.setRotation(this.piston1, 0.0F, 0.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||||
|
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||||
|
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||||
|
this.press1.render(f5);
|
||||||
|
this.piston1.render(f5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render() {
|
||||||
|
this.press1.render(0.0625F);
|
||||||
|
this.piston1.render(0.0625F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||||
|
model.rotateAngleX = x;
|
||||||
|
model.rotateAngleY = y;
|
||||||
|
model.rotateAngleZ = z;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package net.anvilcraft.thaummach.render.tile;
|
||||||
|
|
||||||
|
import net.anvilcraft.thaummach.particles.FXWisp;
|
||||||
|
import net.anvilcraft.thaummach.render.model.ModelDuplicator;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileDuplicator;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public class TileDuplicatorRenderer extends TileEntitySpecialRenderer {
|
||||||
|
private ModelDuplicator model = new ModelDuplicator();
|
||||||
|
|
||||||
|
public void renderEntityAt(TileDuplicator duplicator, double x, double y, double z, float fq) {
|
||||||
|
float dist = 0.1875F - duplicator.press;
|
||||||
|
if (duplicator.getWorldObj().rand.nextFloat()
|
||||||
|
< duplicator.duplicatorCopyTime / duplicator.currentItemCopyCost) {
|
||||||
|
float xx = (float) duplicator.xCoord + 0.5F
|
||||||
|
- (duplicator.getWorldObj().rand.nextFloat()
|
||||||
|
- duplicator.getWorldObj().rand.nextFloat())
|
||||||
|
* 0.7F;
|
||||||
|
float yy = (float) duplicator.yCoord + 0.5F
|
||||||
|
- (duplicator.getWorldObj().rand.nextFloat()
|
||||||
|
- duplicator.getWorldObj().rand.nextFloat())
|
||||||
|
* 0.7F;
|
||||||
|
float zz = (float) duplicator.zCoord + 0.5F
|
||||||
|
- (duplicator.getWorldObj().rand.nextFloat()
|
||||||
|
- duplicator.getWorldObj().rand.nextFloat())
|
||||||
|
* 0.7F;
|
||||||
|
FXWisp ef = new FXWisp(
|
||||||
|
duplicator.getWorldObj(),
|
||||||
|
(double) ((float) duplicator.xCoord + 0.5F),
|
||||||
|
(double) ((float) duplicator.yCoord + 0.5F),
|
||||||
|
(double) ((float) duplicator.zCoord + 0.5F),
|
||||||
|
(double) xx,
|
||||||
|
(double) yy,
|
||||||
|
(double) zz,
|
||||||
|
0.1F,
|
||||||
|
duplicator.getWorldObj().rand.nextInt(5)
|
||||||
|
);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.bindTexture(new ResourceLocation("thaummach", "textures/models/duplicator.png"));
|
||||||
|
GL11.glEnable(0xba1);
|
||||||
|
GL11.glEnable(0xbe2);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glEnable(0x803a);
|
||||||
|
GL11.glBlendFunc(770, 771);
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GL11.glTranslatef((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef(0.0F, -dist, 0.0F);
|
||||||
|
this.model.render();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
GL11.glTranslatef(0.0F, -2.0F - dist, 0.0F);
|
||||||
|
this.model.render();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glDisable(0x803a);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glDisable(0xbe2);
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
|
||||||
|
this.renderEntityAt((TileDuplicator) tileentity, d, d1, d2, f);
|
||||||
|
}
|
||||||
|
}
|
541
src/main/java/net/anvilcraft/thaummach/tiles/TileDuplicator.java
Normal file
|
@ -0,0 +1,541 @@
|
||||||
|
package net.anvilcraft.thaummach.tiles;
|
||||||
|
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
|
import dev.tilera.auracore.api.machine.IUpgradable;
|
||||||
|
import dev.tilera.auracore.api.machine.TileVisUser;
|
||||||
|
import dev.tilera.auracore.aura.AuraManager;
|
||||||
|
import net.anvilcraft.thaummach.GuiID;
|
||||||
|
import net.anvilcraft.thaummach.ITileGui;
|
||||||
|
import net.anvilcraft.thaummach.RecipesCrucible;
|
||||||
|
import net.anvilcraft.thaummach.ThaumicMachinery;
|
||||||
|
import net.anvilcraft.thaummach.packets.PacketDuplicatorPress;
|
||||||
|
import net.anvilcraft.thaummach.particles.FXWisp;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
|
import net.minecraft.item.EnumRarity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import thaumcraft.api.aspects.Aspect;
|
||||||
|
import thaumcraft.api.aspects.AspectList;
|
||||||
|
|
||||||
|
// TODO: make rotatable using AC IWandable
|
||||||
|
public class TileDuplicator extends TileVisUser implements ISidedInventory, IUpgradable, ITileGui {
|
||||||
|
private ItemStack[] duplicatorItemStacks = new ItemStack[10];
|
||||||
|
public float duplicatorCopyTime = 0.0F;
|
||||||
|
public float currentItemCopyCost;
|
||||||
|
public float sucked = 0.0F;
|
||||||
|
public boolean repeat = false;
|
||||||
|
public int boost = 0;
|
||||||
|
private byte[] upgrades = new byte[] { -1 };
|
||||||
|
public int orientation = -1;
|
||||||
|
public float press = 0.0F;
|
||||||
|
public boolean doPress = false;
|
||||||
|
private int pressDelay = 0;
|
||||||
|
int boostDelay = 20;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GuiID getGuiID() {
|
||||||
|
return GuiID.DUPLICATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory() {
|
||||||
|
return this.duplicatorItemStacks.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int i) {
|
||||||
|
return this.duplicatorItemStacks[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int i, int j) {
|
||||||
|
if (this.duplicatorItemStacks[i] != null) {
|
||||||
|
ItemStack itemstack1;
|
||||||
|
if (this.duplicatorItemStacks[i].stackSize <= j) {
|
||||||
|
itemstack1 = this.duplicatorItemStacks[i];
|
||||||
|
this.duplicatorItemStacks[i] = null;
|
||||||
|
return itemstack1;
|
||||||
|
} else {
|
||||||
|
itemstack1 = this.duplicatorItemStacks[i].splitStack(j);
|
||||||
|
if (this.duplicatorItemStacks[i].stackSize == 0) {
|
||||||
|
this.duplicatorItemStacks[i] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemstack1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||||
|
this.duplicatorItemStacks[i] = itemstack;
|
||||||
|
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) {
|
||||||
|
itemstack.stackSize = this.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInventoryName() {
|
||||||
|
return "Thaumic Duplicator";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomInventoryName() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
|
super.readFromNBT(nbttagcompound);
|
||||||
|
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", 10);
|
||||||
|
this.duplicatorItemStacks = new ItemStack[this.getSizeInventory()];
|
||||||
|
|
||||||
|
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||||
|
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.getCompoundTagAt(i);
|
||||||
|
byte byte0 = nbttagcompound1.getByte("SlotDuplicator");
|
||||||
|
if (byte0 >= 0 && byte0 < this.duplicatorItemStacks.length) {
|
||||||
|
this.duplicatorItemStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.duplicatorCopyTime = nbttagcompound.getFloat("CopyTime");
|
||||||
|
this.currentItemCopyCost = nbttagcompound.getFloat("CopyCost");
|
||||||
|
this.repeat = nbttagcompound.getBoolean("Repeat");
|
||||||
|
this.upgrades = nbttagcompound.getByteArray("upgrades");
|
||||||
|
this.orientation = nbttagcompound.getShort("orientation");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||||
|
super.writeToNBT(nbttagcompound);
|
||||||
|
nbttagcompound.setFloat("CopyTime", this.duplicatorCopyTime);
|
||||||
|
nbttagcompound.setFloat("CopyCost", this.currentItemCopyCost);
|
||||||
|
nbttagcompound.setBoolean("Repeat", this.repeat);
|
||||||
|
nbttagcompound.setByteArray("upgrades", this.upgrades);
|
||||||
|
nbttagcompound.setShort("orientation", (short) this.orientation);
|
||||||
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
|
||||||
|
for (int i = 0; i < this.duplicatorItemStacks.length; ++i) {
|
||||||
|
if (this.duplicatorItemStacks[i] != null) {
|
||||||
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||||
|
nbttagcompound1.setByte("SlotDuplicator", (byte) i);
|
||||||
|
this.duplicatorItemStacks[i].writeToNBT(nbttagcompound1);
|
||||||
|
nbttaglist.appendTag(nbttagcompound1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nbttagcompound.setTag("Items", nbttaglist);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit() {
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCookProgressScaled(int i) {
|
||||||
|
return Math.round(this.duplicatorCopyTime / this.currentItemCopyCost * (float) i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBoostScaled() {
|
||||||
|
return Math.round(0.1F + (float) this.boost / 2.0F) * 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCooking() {
|
||||||
|
return this.duplicatorCopyTime > 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity() {
|
||||||
|
super.updateEntity();
|
||||||
|
if (!super.worldObj.isRemote) {
|
||||||
|
boolean flag1 = false;
|
||||||
|
boolean flag = this.duplicatorCopyTime > 0.0F;
|
||||||
|
if (this.canProcess() && this.currentItemCopyCost > 0.0F
|
||||||
|
&& !super.worldObj.isBlockIndirectlyGettingPowered(
|
||||||
|
super.xCoord, super.yCoord, super.zCoord
|
||||||
|
)) {
|
||||||
|
float sa
|
||||||
|
= 0.5F + 0.05F * (float) this.boost + (this.hasUpgrade((byte) 0) ? 0.5F : 0.0F);
|
||||||
|
this.sucked = this.getAvailablePureVis(sa);
|
||||||
|
this.duplicatorCopyTime += this.sucked;
|
||||||
|
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||||
|
} else {
|
||||||
|
this.sucked = 0.0F;
|
||||||
|
}
|
||||||
|
if (this.duplicatorCopyTime >= this.currentItemCopyCost && flag) {
|
||||||
|
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||||
|
AuraManager.addFluxToClosest(
|
||||||
|
this.worldObj,
|
||||||
|
this.xCoord,
|
||||||
|
this.yCoord,
|
||||||
|
this.zCoord,
|
||||||
|
new AspectList().add(
|
||||||
|
Aspect.TAINT, Math.max(1, (int) (this.currentItemCopyCost / 20.0f))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.addProcessedItem();
|
||||||
|
ThaumicMachinery.channel.sendToAllAround(
|
||||||
|
new PacketDuplicatorPress(this.xCoord, this.yCoord, this.zCoord),
|
||||||
|
new TargetPoint(
|
||||||
|
this.worldObj.provider.dimensionId,
|
||||||
|
this.xCoord,
|
||||||
|
this.yCoord,
|
||||||
|
this.zCoord,
|
||||||
|
64
|
||||||
|
)
|
||||||
|
);
|
||||||
|
this.duplicatorCopyTime = 0.0F;
|
||||||
|
this.currentItemCopyCost = 0.0F;
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.currentItemCopyCost != 0.0F
|
||||||
|
&& this.currentItemCopyCost != (float) this.getCopyCost()) {
|
||||||
|
this.duplicatorCopyTime = 0.0F;
|
||||||
|
this.currentItemCopyCost = 0.0F;
|
||||||
|
super.worldObj.playSoundEffect(
|
||||||
|
(double) super.xCoord + 0.5,
|
||||||
|
(double) super.yCoord + 0.5,
|
||||||
|
(double) super.zCoord + 0.5,
|
||||||
|
"random.fizz",
|
||||||
|
1.0F,
|
||||||
|
1.6F
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.duplicatorCopyTime == 0.0F && this.canProcess()) {
|
||||||
|
this.currentItemCopyCost = (float) this.getCopyCost();
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag != this.duplicatorCopyTime > 0.0F) {
|
||||||
|
flag1 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag1) {
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: magic boost
|
||||||
|
//if (this.boostDelay <= 0 || this.boostDelay == 10) {
|
||||||
|
// auraX = super.xCoord >> 4;
|
||||||
|
// auraZ = super.zCoord >> 4;
|
||||||
|
// ac = (SIAuraChunk) mod_ThaumCraft.AuraHM.get(Arrays.asList(
|
||||||
|
// auraX, auraZ, ThaumCraftCore.getDimension(super.worldObj)
|
||||||
|
// ));
|
||||||
|
// if (ac != null && this.boost < 10 && ac.boost > 0) {
|
||||||
|
// ++this.boost;
|
||||||
|
// --ac.boost;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (this.boostDelay <= 0) {
|
||||||
|
if (this.boost > 0) {
|
||||||
|
--this.boost;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.boostDelay = 20;
|
||||||
|
} else {
|
||||||
|
--this.boostDelay;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.press > 0.0F && !this.doPress) {
|
||||||
|
this.press *= 0.97F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.press < 0.125F && !this.doPress) {
|
||||||
|
this.press = 0.125F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.press < 0.1875F && this.doPress) {
|
||||||
|
this.press *= 1.1F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.press >= 0.1875F && this.doPress && this.pressDelay <= 0) {
|
||||||
|
this.pressDelay = 12;
|
||||||
|
this.press = 0.1875F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.pressDelay > 0) {
|
||||||
|
--this.pressDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.pressDelay <= 0 && this.doPress && this.press >= 0.1875F) {
|
||||||
|
this.doPress = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCopyCost() {
|
||||||
|
if (this.duplicatorItemStacks[9] != null
|
||||||
|
&& this.duplicatorItemStacks[9].getRarity() == EnumRarity.common) {
|
||||||
|
if (this.duplicatorItemStacks[9].getItem()
|
||||||
|
== Item.getItemFromBlock(Blocks.cobblestone)) {
|
||||||
|
return 2;
|
||||||
|
} else {
|
||||||
|
float t = RecipesCrucible.smelting().getSmeltingResult(
|
||||||
|
this.duplicatorItemStacks[9], true, false
|
||||||
|
);
|
||||||
|
if (t > 0.0F) {
|
||||||
|
int tr = Math.round(t * (float) (this.hasUpgrade((byte) 1) ? 4 : 5));
|
||||||
|
return tr;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canProcess() {
|
||||||
|
if (this.duplicatorItemStacks[9] == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
for (int j = 0; j < 9; ++j) {
|
||||||
|
if (this.duplicatorItemStacks[j] == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.duplicatorItemStacks[j].isItemEqual(this.duplicatorItemStacks[9])) {
|
||||||
|
int st = this.duplicatorItemStacks[j].stackSize + 1;
|
||||||
|
if (!this.repeat) {
|
||||||
|
++st;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (st <= this.getInventoryStackLimit()
|
||||||
|
&& st <= this.duplicatorItemStacks[j].getMaxStackSize()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addProcessedItem() {
|
||||||
|
if (this.canProcess()) {
|
||||||
|
ItemStack itemstack = new ItemStack(
|
||||||
|
this.duplicatorItemStacks[9].getItem(),
|
||||||
|
1,
|
||||||
|
this.duplicatorItemStacks[9].getItemDamage()
|
||||||
|
);
|
||||||
|
int repeats = 1;
|
||||||
|
if (!this.repeat) {
|
||||||
|
repeats = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int q = 0; q < repeats; ++q) {
|
||||||
|
for (int j = 0; j < 9; ++j) {
|
||||||
|
if (this.duplicatorItemStacks[j] == null) {
|
||||||
|
this.duplicatorItemStacks[j] = itemstack.copy();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.duplicatorItemStacks[j].isItemEqual(itemstack)
|
||||||
|
&& this.duplicatorItemStacks[j].stackSize < itemstack.getMaxStackSize()) {
|
||||||
|
ItemStack var10000 = this.duplicatorItemStacks[j];
|
||||||
|
var10000.stackSize += itemstack.stackSize;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.repeat) {
|
||||||
|
--this.duplicatorItemStacks[9].stackSize;
|
||||||
|
if (this.duplicatorItemStacks[9].stackSize <= 0) {
|
||||||
|
this.duplicatorItemStacks[9] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//@Override
|
||||||
|
//public int getStartInventorySide(int side) {
|
||||||
|
// return side != 0 && side != 1 ? 0 : 9;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//@Override
|
||||||
|
//public int getSizeInventorySide(int side) {
|
||||||
|
// return side != 0 && side != 1 ? 9 : 1;
|
||||||
|
//}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getConnectable(ForgeDirection face) {
|
||||||
|
switch (face) {
|
||||||
|
case NORTH:
|
||||||
|
case EAST:
|
||||||
|
case SOUTH:
|
||||||
|
case WEST:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canAcceptUpgrade(byte upgrade) {
|
||||||
|
if (upgrade != 0 && upgrade != 1) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return !this.hasUpgrade(upgrade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getUpgradeLimit() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] getUpgrades() {
|
||||||
|
return this.upgrades;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasUpgrade(byte upgrade) {
|
||||||
|
if (this.upgrades.length < 1) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
for (int a = 0; a < this.getUpgradeLimit(); ++a) {
|
||||||
|
if (this.upgrades[a] == upgrade) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setUpgrade(byte upgrade) {
|
||||||
|
for (int a = 0; a < this.getUpgradeLimit(); ++a) {
|
||||||
|
if (this.upgrades[a] < 0 && this.canAcceptUpgrade(upgrade)) {
|
||||||
|
this.upgrades[a] = upgrade;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean clearUpgrade(int index) {
|
||||||
|
if (this.upgrades[index] >= 0) {
|
||||||
|
this.upgrades[index] = -1;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: IWandable
|
||||||
|
//@Override
|
||||||
|
//public boolean rotate() {
|
||||||
|
// ++this.orientation;
|
||||||
|
// if (this.orientation > 3) {
|
||||||
|
// this.orientation -= 4;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int var1) {
|
||||||
|
if (this.duplicatorItemStacks[var1] != null) {
|
||||||
|
ItemStack var2 = this.duplicatorItemStacks[var1];
|
||||||
|
this.duplicatorItemStacks[var1] = null;
|
||||||
|
return var2;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getAccessibleSlotsFromSide(int side) {
|
||||||
|
// output slot for top/bottom
|
||||||
|
switch (side) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
return new int[] { 9 };
|
||||||
|
|
||||||
|
default:
|
||||||
|
return IntStream.range(0, 9).toArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slot, ItemStack stack, int side) {
|
||||||
|
return this.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int slot, ItemStack otherStack, int side) {
|
||||||
|
ItemStack thisStack = this.duplicatorItemStacks[slot];
|
||||||
|
|
||||||
|
return thisStack != null && thisStack.isItemEqual(otherStack)
|
||||||
|
&& thisStack.stackSize >= otherStack.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Packet getDescriptionPacket() {
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
|
||||||
|
nbt.setFloat("duplicatorCopyTime", this.duplicatorCopyTime);
|
||||||
|
nbt.setFloat("currentItemCopyCost", this.currentItemCopyCost);
|
||||||
|
nbt.setFloat("sucked", this.sucked);
|
||||||
|
nbt.setBoolean("repeat", this.repeat);
|
||||||
|
nbt.setInteger("boost", this.boost);
|
||||||
|
nbt.setByteArray("upgrades", this.upgrades);
|
||||||
|
nbt.setInteger("orientation", this.orientation);
|
||||||
|
|
||||||
|
return new S35PacketUpdateTileEntity(
|
||||||
|
this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
|
NBTTagCompound nbt = pkt.func_148857_g();
|
||||||
|
|
||||||
|
this.duplicatorCopyTime = nbt.getFloat("duplicatorCopyTime");
|
||||||
|
this.currentItemCopyCost = nbt.getFloat("currentItemCopyCost");
|
||||||
|
this.sucked = nbt.getFloat("sucked");
|
||||||
|
this.repeat = nbt.getBoolean("repeat");
|
||||||
|
this.boost = nbt.getInteger("boost");
|
||||||
|
this.upgrades = nbt.getByteArray("upgrades");
|
||||||
|
this.orientation = nbt.getInteger("orientation");
|
||||||
|
}
|
||||||
|
}
|
|
@ -62,6 +62,19 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"stomp": {
|
||||||
|
"category": "block",
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "stomp1",
|
||||||
|
"stream": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stomp2",
|
||||||
|
"stream": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"upgrade": {
|
"upgrade": {
|
||||||
"category": "master",
|
"category": "master",
|
||||||
"sounds": [
|
"sounds": [
|
||||||
|
|
BIN
src/main/resources/assets/thaummach/sounds/stomp1.ogg
Normal file
BIN
src/main/resources/assets/thaummach/sounds/stomp2.ogg
Normal file
Before Width: | Height: | Size: 609 B After Width: | Height: | Size: 675 B |
After Width: | Height: | Size: 506 B |
Before Width: | Height: | Size: 506 B After Width: | Height: | Size: 609 B |
Before Width: | Height: | Size: 675 B |
BIN
src/main/resources/assets/thaummach/textures/guis/duplicator.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.8 KiB |