mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-27 07:13:14 +00:00
Compare commits
4
Commits
master
...
1.7.44-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da31dfef7e | ||
|
|
084555d433 | ||
|
|
333fad3536 | ||
|
|
8a4711b383 |
No files matched your search
+2
-2
@@ -23,10 +23,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("com.github.GTNewHorizons:waila:1.8.8:dev")
|
api("com.github.GTNewHorizons:waila:1.8.10:dev")
|
||||||
api("com.github.GTNewHorizons:NotEnoughItems:2.7.59-GTNH:dev")
|
api("com.github.GTNewHorizons:NotEnoughItems:2.7.59-GTNH:dev")
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.359:dev") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.362:dev") {transitive = false }
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:Botania:1.12.12-GTNH:api") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:Botania:1.12.12-GTNH:api") {transitive = false }
|
||||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.13:api") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.13:api") {transitive = false }
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import java.util.BitSet;
|
|||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -45,7 +47,7 @@ public enum NewPacketHandler {
|
|||||||
|
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
private EnumMap<Side, FMLEmbeddedChannel> channels;
|
private final EnumMap<Side, FMLEmbeddedChannel> channels;
|
||||||
|
|
||||||
NewPacketHandler() {
|
NewPacketHandler() {
|
||||||
this.channels = NetworkRegistry.INSTANCE.newChannel("BloodMagic", new TEAltarCodec());
|
this.channels = NetworkRegistry.INSTANCE.newChannel("BloodMagic", new TEAltarCodec());
|
||||||
@@ -95,12 +97,10 @@ public enum NewPacketHandler {
|
|||||||
private static class TEAltarMessageHandler extends SimpleChannelInboundHandler<TEAltarMessage> {
|
private static class TEAltarMessageHandler extends SimpleChannelInboundHandler<TEAltarMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TEAltarMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TEAltarMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TEAltar) {
|
if (te instanceof TEAltar altar) {
|
||||||
TEAltar altar = (TEAltar) te;
|
|
||||||
|
|
||||||
altar.handlePacketData(msg.items, msg.fluids, msg.capacity);
|
altar.handlePacketData(msg.items, msg.fluids, msg.capacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,12 +109,12 @@ public enum NewPacketHandler {
|
|||||||
private static class TEOrientableMessageHandler extends SimpleChannelInboundHandler<TEOrientableMessage> {
|
private static class TEOrientableMessageHandler extends SimpleChannelInboundHandler<TEOrientableMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TEOrientableMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TEOrientableMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TEOrientable) {
|
if (te instanceof TEOrientable teOrientable) {
|
||||||
((TEOrientable) te).setInputDirection(ForgeDirection.getOrientation(msg.input));
|
teOrientable.setInputDirection(ForgeDirection.getOrientation(msg.input));
|
||||||
((TEOrientable) te).setOutputDirection(ForgeDirection.getOrientation(msg.output));
|
teOrientable.setOutputDirection(ForgeDirection.getOrientation(msg.output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,12 +122,10 @@ public enum NewPacketHandler {
|
|||||||
private static class TEPedestalMessageHandler extends SimpleChannelInboundHandler<TEPedestalMessage> {
|
private static class TEPedestalMessageHandler extends SimpleChannelInboundHandler<TEPedestalMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TEPedestalMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TEPedestalMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TEPedestal) {
|
if (te instanceof TEPedestal pedestal) {
|
||||||
TEPedestal pedestal = (TEPedestal) te;
|
|
||||||
|
|
||||||
pedestal.handlePacketData(msg.items);
|
pedestal.handlePacketData(msg.items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,12 +134,10 @@ public enum NewPacketHandler {
|
|||||||
private static class TEPlinthMessageHandler extends SimpleChannelInboundHandler<TEPlinthMessage> {
|
private static class TEPlinthMessageHandler extends SimpleChannelInboundHandler<TEPlinthMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TEPlinthMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TEPlinthMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TEPlinth) {
|
if (te instanceof TEPlinth Plinth) {
|
||||||
TEPlinth Plinth = (TEPlinth) te;
|
|
||||||
|
|
||||||
Plinth.handlePacketData(msg.items);
|
Plinth.handlePacketData(msg.items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,12 +146,10 @@ public enum NewPacketHandler {
|
|||||||
private static class TESocketMessageHandler extends SimpleChannelInboundHandler<TESocketMessage> {
|
private static class TESocketMessageHandler extends SimpleChannelInboundHandler<TESocketMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TESocketMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TESocketMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TESocket) {
|
if (te instanceof TESocket Socket) {
|
||||||
TESocket Socket = (TESocket) te;
|
|
||||||
|
|
||||||
Socket.handlePacketData(msg.items);
|
Socket.handlePacketData(msg.items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,12 +158,10 @@ public enum NewPacketHandler {
|
|||||||
private static class TETeleposerMessageHandler extends SimpleChannelInboundHandler<TETeleposerMessage> {
|
private static class TETeleposerMessageHandler extends SimpleChannelInboundHandler<TETeleposerMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TETeleposerMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TETeleposerMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TETeleposer) {
|
if (te instanceof TETeleposer Teleposer) {
|
||||||
TETeleposer Teleposer = (TETeleposer) te;
|
|
||||||
|
|
||||||
Teleposer.handlePacketData(msg.items);
|
Teleposer.handlePacketData(msg.items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -178,12 +170,10 @@ public enum NewPacketHandler {
|
|||||||
private static class TEWritingTableMessageHandler extends SimpleChannelInboundHandler<TEWritingTableMessage> {
|
private static class TEWritingTableMessageHandler extends SimpleChannelInboundHandler<TEWritingTableMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TEWritingTableMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TEWritingTableMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TEWritingTable) {
|
if (te instanceof TEWritingTable WritingTable) {
|
||||||
TEWritingTable WritingTable = (TEWritingTable) te;
|
|
||||||
|
|
||||||
WritingTable.handlePacketData(msg.items);
|
WritingTable.handlePacketData(msg.items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +182,7 @@ public enum NewPacketHandler {
|
|||||||
private static class ParticleMessageHandler extends SimpleChannelInboundHandler<ParticleMessage> {
|
private static class ParticleMessageHandler extends SimpleChannelInboundHandler<ParticleMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, ParticleMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, ParticleMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
|
|
||||||
world.spawnParticle(msg.particle, msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel);
|
world.spawnParticle(msg.particle, msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel);
|
||||||
@@ -202,7 +192,7 @@ public enum NewPacketHandler {
|
|||||||
private static class VelocityMessageHandler extends SimpleChannelInboundHandler<VelocityMessage> {
|
private static class VelocityMessageHandler extends SimpleChannelInboundHandler<VelocityMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, VelocityMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, VelocityMessage msg) {
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
@@ -216,12 +206,10 @@ public enum NewPacketHandler {
|
|||||||
private static class TEMasterStoneMessageHandler extends SimpleChannelInboundHandler<TEMasterStoneMessage> {
|
private static class TEMasterStoneMessageHandler extends SimpleChannelInboundHandler<TEMasterStoneMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TEMasterStoneMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TEMasterStoneMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TEMasterStone) {
|
if (te instanceof TEMasterStone masterStone) {
|
||||||
TEMasterStone masterStone = (TEMasterStone) te;
|
|
||||||
|
|
||||||
masterStone.setCurrentRitual(msg.ritual);
|
masterStone.setCurrentRitual(msg.ritual);
|
||||||
masterStone.isRunning = msg.isRunning;
|
masterStone.isRunning = msg.isRunning;
|
||||||
}
|
}
|
||||||
@@ -231,12 +219,10 @@ public enum NewPacketHandler {
|
|||||||
private static class TEReagentConduitMessageHandler extends SimpleChannelInboundHandler<TEReagentConduitMessage> {
|
private static class TEReagentConduitMessageHandler extends SimpleChannelInboundHandler<TEReagentConduitMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TEReagentConduitMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, TEReagentConduitMessage msg) {
|
||||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||||
if (te instanceof TEReagentConduit) {
|
if (te instanceof TEReagentConduit reagentConduit) {
|
||||||
TEReagentConduit reagentConduit = (TEReagentConduit) te;
|
|
||||||
|
|
||||||
reagentConduit.destinationList = msg.destinationList;
|
reagentConduit.destinationList = msg.destinationList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,7 +231,7 @@ public enum NewPacketHandler {
|
|||||||
private static class CurrentLPMessageHandler extends SimpleChannelInboundHandler<CurrentLPMessage> {
|
private static class CurrentLPMessageHandler extends SimpleChannelInboundHandler<CurrentLPMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, CurrentLPMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, CurrentLPMessage msg) {
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
|
||||||
APISpellHelper.setPlayerLPTag(player, msg.currentLP);
|
APISpellHelper.setPlayerLPTag(player, msg.currentLP);
|
||||||
@@ -256,7 +242,7 @@ public enum NewPacketHandler {
|
|||||||
private static class CurrentReagentBarMessageHandler extends SimpleChannelInboundHandler<CurrentReagentBarMessage> {
|
private static class CurrentReagentBarMessageHandler extends SimpleChannelInboundHandler<CurrentReagentBarMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, CurrentReagentBarMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, CurrentReagentBarMessage msg) {
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
|
||||||
APISpellHelper.setPlayerReagentType(player, msg.reagent);
|
APISpellHelper.setPlayerReagentType(player, msg.reagent);
|
||||||
@@ -268,7 +254,7 @@ public enum NewPacketHandler {
|
|||||||
private static class CurrentAddedHPMessageHandler extends SimpleChannelInboundHandler<CurrentAddedHPMessage> {
|
private static class CurrentAddedHPMessageHandler extends SimpleChannelInboundHandler<CurrentAddedHPMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, CurrentAddedHPMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, CurrentAddedHPMessage msg) {
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
|
||||||
APISpellHelper.setCurrentAdditionalHP(player, msg.currentHP);
|
APISpellHelper.setCurrentAdditionalHP(player, msg.currentHP);
|
||||||
@@ -283,7 +269,7 @@ public enum NewPacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, KeyboardMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, KeyboardMessage msg) {
|
||||||
System.out.println("Hmmm");
|
System.out.println("Hmmm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,7 +277,7 @@ public enum NewPacketHandler {
|
|||||||
private static class GaiaBiomeChangeMessageHandler extends SimpleChannelInboundHandler<GaiaBiomeChangeMessage> {
|
private static class GaiaBiomeChangeMessageHandler extends SimpleChannelInboundHandler<GaiaBiomeChangeMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, GaiaBiomeChangeMessage msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, GaiaBiomeChangeMessage msg) {
|
||||||
Chunk chunk = AlchemicalWizardry.proxy.getClientWorld().getChunkFromChunkCoords(msg.chunkX, msg.chunkZ);
|
Chunk chunk = AlchemicalWizardry.proxy.getClientWorld().getChunkFromChunkCoords(msg.chunkX, msg.chunkZ);
|
||||||
if (chunk != null) {
|
if (chunk != null) {
|
||||||
byte[] biomeArray = chunk.getBiomeArray();
|
byte[] biomeArray = chunk.getBiomeArray();
|
||||||
@@ -449,30 +435,7 @@ public enum NewPacketHandler {
|
|||||||
public static final int maskByteCount = 32;
|
public static final int maskByteCount = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec<BMMessage> {
|
private static class TEAltarCodec extends FMLIndexedMessageToMessageCodec<BMMessage> {
|
||||||
|
|
||||||
public ClientToServerCodec() {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception {
|
|
||||||
target.writeInt(msg.index);
|
|
||||||
|
|
||||||
// switch(msg.index)
|
|
||||||
{}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, BMMessage msg) {
|
|
||||||
int index = source.readInt();
|
|
||||||
|
|
||||||
System.out.println("Packet is recieved and being decoded");
|
|
||||||
|
|
||||||
// switch(index)
|
|
||||||
{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TEAltarCodec extends FMLIndexedMessageToMessageCodec<BMMessage> {
|
|
||||||
|
|
||||||
public TEAltarCodec() {
|
public TEAltarCodec() {
|
||||||
addDiscriminator(0, TEAltarMessage.class);
|
addDiscriminator(0, TEAltarMessage.class);
|
||||||
@@ -494,175 +457,141 @@ public enum NewPacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception {
|
public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) {
|
||||||
target.writeInt(msg.index);
|
target.writeInt(msg.index);
|
||||||
|
|
||||||
switch (msg.index) {
|
switch (msg.index) {
|
||||||
case 0:
|
case 0 -> {
|
||||||
target.writeInt(((TEAltarMessage) msg).x);
|
TEAltarMessage m = (TEAltarMessage) msg;
|
||||||
target.writeInt(((TEAltarMessage) msg).y);
|
target.writeInt(m.x);
|
||||||
target.writeInt(((TEAltarMessage) msg).z);
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
target.writeBoolean(((TEAltarMessage) msg).items != null);
|
target.writeBoolean(m.items != null);
|
||||||
if (((TEAltarMessage) msg).items != null) {
|
if (m.items != null) {
|
||||||
int[] items = ((TEAltarMessage) msg).items;
|
int[] items = m.items;
|
||||||
for (int j = 0; j < items.length; j++) {
|
Arrays.stream(items).forEach(target::writeInt);
|
||||||
int i = items[j];
|
|
||||||
target.writeInt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target.writeBoolean(((TEAltarMessage) msg).fluids != null);
|
target.writeBoolean(m.fluids != null);
|
||||||
if (((TEAltarMessage) msg).fluids != null) {
|
if (m.fluids != null) {
|
||||||
int[] fluids = ((TEAltarMessage) msg).fluids;
|
int[] fluids = m.fluids;
|
||||||
for (int j = 0; j < fluids.length; j++) {
|
Arrays.stream(fluids).forEach(target::writeInt);
|
||||||
int i = fluids[j];
|
|
||||||
target.writeInt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target.writeInt(((TEAltarMessage) msg).capacity);
|
target.writeInt(m.capacity);
|
||||||
|
}
|
||||||
|
case 1 -> {
|
||||||
|
TEOrientableMessage m = (TEOrientableMessage) msg;
|
||||||
|
target.writeInt(m.x);
|
||||||
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
break;
|
target.writeInt(m.input);
|
||||||
|
target.writeInt(m.output);
|
||||||
|
}
|
||||||
|
case 2 -> {
|
||||||
|
TEPedestalMessage m = (TEPedestalMessage) msg;
|
||||||
|
target.writeInt(m.x);
|
||||||
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
case 1:
|
target.writeBoolean(m.items != null);
|
||||||
target.writeInt(((TEOrientableMessage) msg).x);
|
if (m.items != null) {
|
||||||
target.writeInt(((TEOrientableMessage) msg).y);
|
int[] items = m.items;
|
||||||
target.writeInt(((TEOrientableMessage) msg).z);
|
Arrays.stream(items).forEach(target::writeInt);
|
||||||
|
|
||||||
target.writeInt(((TEOrientableMessage) msg).input);
|
|
||||||
target.writeInt(((TEOrientableMessage) msg).output);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
target.writeInt(((TEPedestalMessage) msg).x);
|
|
||||||
target.writeInt(((TEPedestalMessage) msg).y);
|
|
||||||
target.writeInt(((TEPedestalMessage) msg).z);
|
|
||||||
|
|
||||||
target.writeBoolean(((TEPedestalMessage) msg).items != null);
|
|
||||||
if (((TEPedestalMessage) msg).items != null) {
|
|
||||||
int[] items = ((TEPedestalMessage) msg).items;
|
|
||||||
for (int j = 0; j < items.length; j++) {
|
|
||||||
int i = items[j];
|
|
||||||
target.writeInt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 3 -> {
|
||||||
|
TEPlinthMessage m = (TEPlinthMessage) msg;
|
||||||
|
target.writeInt(m.x);
|
||||||
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
break;
|
target.writeBoolean(m.items != null);
|
||||||
|
if (m.items != null) {
|
||||||
case 3:
|
int[] items = m.items;
|
||||||
target.writeInt(((TEPlinthMessage) msg).x);
|
Arrays.stream(items).forEach(target::writeInt);
|
||||||
target.writeInt(((TEPlinthMessage) msg).y);
|
|
||||||
target.writeInt(((TEPlinthMessage) msg).z);
|
|
||||||
|
|
||||||
target.writeBoolean(((TEPlinthMessage) msg).items != null);
|
|
||||||
if (((TEPlinthMessage) msg).items != null) {
|
|
||||||
int[] items = ((TEPlinthMessage) msg).items;
|
|
||||||
for (int j = 0; j < items.length; j++) {
|
|
||||||
int i = items[j];
|
|
||||||
target.writeInt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 4 -> {
|
||||||
|
TESocketMessage m = (TESocketMessage) msg;
|
||||||
|
target.writeInt(m.x);
|
||||||
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
break;
|
target.writeBoolean(m.items != null);
|
||||||
|
if (m.items != null) {
|
||||||
case 4:
|
int[] items = m.items;
|
||||||
target.writeInt(((TESocketMessage) msg).x);
|
Arrays.stream(items).forEach(target::writeInt);
|
||||||
target.writeInt(((TESocketMessage) msg).y);
|
|
||||||
target.writeInt(((TESocketMessage) msg).z);
|
|
||||||
|
|
||||||
target.writeBoolean(((TESocketMessage) msg).items != null);
|
|
||||||
if (((TESocketMessage) msg).items != null) {
|
|
||||||
int[] items = ((TESocketMessage) msg).items;
|
|
||||||
for (int j = 0; j < items.length; j++) {
|
|
||||||
int i = items[j];
|
|
||||||
target.writeInt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 5 -> {
|
||||||
|
TETeleposerMessage m = (TETeleposerMessage) msg;
|
||||||
|
target.writeInt(m.x);
|
||||||
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
break;
|
target.writeBoolean(m.items != null);
|
||||||
|
if (m.items != null) {
|
||||||
case 5:
|
int[] items = m.items;
|
||||||
target.writeInt(((TETeleposerMessage) msg).x);
|
Arrays.stream(items).forEach(target::writeInt);
|
||||||
target.writeInt(((TETeleposerMessage) msg).y);
|
|
||||||
target.writeInt(((TETeleposerMessage) msg).z);
|
|
||||||
|
|
||||||
target.writeBoolean(((TETeleposerMessage) msg).items != null);
|
|
||||||
if (((TETeleposerMessage) msg).items != null) {
|
|
||||||
int[] items = ((TETeleposerMessage) msg).items;
|
|
||||||
for (int j = 0; j < items.length; j++) {
|
|
||||||
int i = items[j];
|
|
||||||
target.writeInt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 6 -> {
|
||||||
|
TEWritingTableMessage m = (TEWritingTableMessage) msg;
|
||||||
|
target.writeInt(m.x);
|
||||||
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
break;
|
target.writeBoolean(m.items != null);
|
||||||
|
if (m.items != null) {
|
||||||
case 6:
|
int[] items = m.items;
|
||||||
target.writeInt(((TEWritingTableMessage) msg).x);
|
Arrays.stream(items).forEach(target::writeInt);
|
||||||
target.writeInt(((TEWritingTableMessage) msg).y);
|
|
||||||
target.writeInt(((TEWritingTableMessage) msg).z);
|
|
||||||
|
|
||||||
target.writeBoolean(((TEWritingTableMessage) msg).items != null);
|
|
||||||
if (((TEWritingTableMessage) msg).items != null) {
|
|
||||||
int[] items = ((TEWritingTableMessage) msg).items;
|
|
||||||
for (int j = 0; j < items.length; j++) {
|
|
||||||
int i = items[j];
|
|
||||||
target.writeInt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
case 7 -> {
|
||||||
|
ParticleMessage m = (ParticleMessage) msg;
|
||||||
case 7:
|
String str = m.particle;
|
||||||
String str = ((ParticleMessage) msg).particle;
|
|
||||||
target.writeInt(str.length());
|
target.writeInt(str.length());
|
||||||
for (int i = 0; i < str.length(); i++) {
|
IntStream.range(0, str.length()).map(str::charAt).forEach(target::writeChar);
|
||||||
target.writeChar(str.charAt(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
target.writeDouble(((ParticleMessage) msg).xCoord);
|
target.writeDouble(m.xCoord);
|
||||||
target.writeDouble(((ParticleMessage) msg).yCoord);
|
target.writeDouble(m.yCoord);
|
||||||
target.writeDouble(((ParticleMessage) msg).zCoord);
|
target.writeDouble(m.zCoord);
|
||||||
|
|
||||||
target.writeDouble(((ParticleMessage) msg).xVel);
|
target.writeDouble(m.xVel);
|
||||||
target.writeDouble(((ParticleMessage) msg).yVel);
|
target.writeDouble(m.yVel);
|
||||||
target.writeDouble(((ParticleMessage) msg).zVel);
|
target.writeDouble(m.zVel);
|
||||||
|
}
|
||||||
|
case 8 -> {
|
||||||
|
VelocityMessage m = (VelocityMessage) msg;
|
||||||
|
target.writeDouble(m.xVel);
|
||||||
|
target.writeDouble(m.yVel);
|
||||||
|
target.writeDouble(m.zVel);
|
||||||
|
}
|
||||||
|
case 9 -> {
|
||||||
|
TEMasterStoneMessage m = (TEMasterStoneMessage) msg;
|
||||||
|
target.writeInt(m.x);
|
||||||
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
break;
|
String ritual = m.ritual;
|
||||||
|
|
||||||
case 8:
|
|
||||||
target.writeDouble(((VelocityMessage) msg).xVel);
|
|
||||||
target.writeDouble(((VelocityMessage) msg).yVel);
|
|
||||||
target.writeDouble(((VelocityMessage) msg).zVel);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
target.writeInt(((TEMasterStoneMessage) msg).x);
|
|
||||||
target.writeInt(((TEMasterStoneMessage) msg).y);
|
|
||||||
target.writeInt(((TEMasterStoneMessage) msg).z);
|
|
||||||
|
|
||||||
String ritual = ((TEMasterStoneMessage) msg).ritual;
|
|
||||||
target.writeInt(ritual.length());
|
target.writeInt(ritual.length());
|
||||||
for (int i = 0; i < ritual.length(); i++) {
|
IntStream.range(0, ritual.length()).map(ritual::charAt).forEach(target::writeChar);
|
||||||
target.writeChar(ritual.charAt(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
target.writeBoolean(((TEMasterStoneMessage) msg).isRunning);
|
target.writeBoolean(m.isRunning);
|
||||||
|
}
|
||||||
|
case 10 -> {
|
||||||
|
TEReagentConduitMessage m = (TEReagentConduitMessage) msg;
|
||||||
|
target.writeInt(m.x);
|
||||||
|
target.writeInt(m.y);
|
||||||
|
target.writeInt(m.z);
|
||||||
|
|
||||||
break;
|
List<ColourAndCoords> list = m.destinationList;
|
||||||
|
|
||||||
case 10:
|
|
||||||
target.writeInt(((TEReagentConduitMessage) msg).x);
|
|
||||||
target.writeInt(((TEReagentConduitMessage) msg).y);
|
|
||||||
target.writeInt(((TEReagentConduitMessage) msg).z);
|
|
||||||
|
|
||||||
List<ColourAndCoords> list = ((TEReagentConduitMessage) msg).destinationList;
|
|
||||||
target.writeInt(list.size());
|
target.writeInt(list.size());
|
||||||
|
|
||||||
for (ColourAndCoords colourSet : list) {
|
list.forEach(colourSet -> {
|
||||||
target.writeInt(colourSet.colourRed);
|
target.writeInt(colourSet.colourRed);
|
||||||
target.writeInt(colourSet.colourGreen);
|
target.writeInt(colourSet.colourGreen);
|
||||||
target.writeInt(colourSet.colourBlue);
|
target.writeInt(colourSet.colourBlue);
|
||||||
@@ -670,49 +599,37 @@ public enum NewPacketHandler {
|
|||||||
target.writeInt(colourSet.xCoord);
|
target.writeInt(colourSet.xCoord);
|
||||||
target.writeInt(colourSet.yCoord);
|
target.writeInt(colourSet.yCoord);
|
||||||
target.writeInt(colourSet.zCoord);
|
target.writeInt(colourSet.zCoord);
|
||||||
}
|
});
|
||||||
|
}
|
||||||
break;
|
case 11 -> {
|
||||||
|
CurrentLPMessage m = (CurrentLPMessage) msg;
|
||||||
case 11:
|
target.writeInt(m.currentLP);
|
||||||
target.writeInt(((CurrentLPMessage) msg).currentLP);
|
target.writeInt(m.maxLP);
|
||||||
target.writeInt(((CurrentLPMessage) msg).maxLP);
|
}
|
||||||
|
case 12 -> {
|
||||||
break;
|
CurrentReagentBarMessage m = (CurrentReagentBarMessage) msg;
|
||||||
|
char[] charSet = m.reagent.toCharArray();
|
||||||
case 12:
|
|
||||||
char[] charSet = ((CurrentReagentBarMessage) msg).reagent.toCharArray();
|
|
||||||
target.writeInt(charSet.length);
|
target.writeInt(charSet.length);
|
||||||
for (char cha : charSet) {
|
for (char cha : charSet) {
|
||||||
target.writeChar(cha);
|
target.writeChar(cha);
|
||||||
}
|
}
|
||||||
target.writeFloat(((CurrentReagentBarMessage) msg).currentAR);
|
target.writeFloat(m.currentAR);
|
||||||
target.writeFloat(((CurrentReagentBarMessage) msg).maxAR);
|
target.writeFloat(m.maxAR);
|
||||||
|
}
|
||||||
break;
|
case 13 -> {
|
||||||
|
CurrentAddedHPMessage m = (CurrentAddedHPMessage) msg;
|
||||||
case 13:
|
target.writeFloat(m.currentHP);
|
||||||
target.writeFloat(((CurrentAddedHPMessage) msg).currentHP);
|
target.writeFloat(m.maxHP);
|
||||||
target.writeFloat(((CurrentAddedHPMessage) msg).maxHP);
|
}
|
||||||
|
case 14 -> target.writeByte(((KeyboardMessage) msg).keyPressed);
|
||||||
break;
|
case 15 -> {
|
||||||
|
GaiaBiomeChangeMessage m = (GaiaBiomeChangeMessage) msg;
|
||||||
case 14:
|
target.writeInt(m.chunkX);
|
||||||
System.out.println("Packet is being encoded");
|
target.writeInt(m.chunkZ);
|
||||||
|
target.writeByte(m.biome);
|
||||||
target.writeByte(((KeyboardMessage) msg).keyPressed);
|
byte[] arr = Arrays.copyOf(m.mask.toByteArray(), GaiaBiomeChangeMessage.maskByteCount);
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
target.writeInt(((GaiaBiomeChangeMessage) msg).chunkX);
|
|
||||||
target.writeInt(((GaiaBiomeChangeMessage) msg).chunkZ);
|
|
||||||
target.writeByte(((GaiaBiomeChangeMessage) msg).biome);
|
|
||||||
byte[] arr = Arrays.copyOf(
|
|
||||||
((GaiaBiomeChangeMessage) msg).mask.toByteArray(),
|
|
||||||
GaiaBiomeChangeMessage.maskByteCount);
|
|
||||||
target.writeBytes(arr);
|
target.writeBytes(arr);
|
||||||
break;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,233 +638,183 @@ public enum NewPacketHandler {
|
|||||||
int index = dat.readInt();
|
int index = dat.readInt();
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0 -> {
|
||||||
((TEAltarMessage) msg).x = dat.readInt();
|
TEAltarMessage m = (TEAltarMessage) msg;
|
||||||
((TEAltarMessage) msg).y = dat.readInt();
|
m.x = dat.readInt();
|
||||||
((TEAltarMessage) msg).z = dat.readInt();
|
m.y = dat.readInt();
|
||||||
|
m.z = dat.readInt();
|
||||||
boolean hasStacks = dat.readBoolean();
|
boolean hasStacks = dat.readBoolean();
|
||||||
|
|
||||||
((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3];
|
m.items = new int[TEAltar.sizeInv * 3];
|
||||||
if (hasStacks) {
|
if (hasStacks) {
|
||||||
((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3];
|
m.items = new int[TEAltar.sizeInv * 3];
|
||||||
for (int i = 0; i < ((TEAltarMessage) msg).items.length; i++) {
|
IntStream.range(0, m.items.length).forEach(i -> m.items[i] = dat.readInt());
|
||||||
((TEAltarMessage) msg).items[i] = dat.readInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasFluids = dat.readBoolean();
|
boolean hasFluids = dat.readBoolean();
|
||||||
((TEAltarMessage) msg).fluids = new int[6];
|
m.fluids = new int[6];
|
||||||
if (hasFluids) for (int i = 0; i < ((TEAltarMessage) msg).fluids.length; i++) {
|
if (hasFluids) IntStream.range(0, m.fluids.length).forEach(i -> m.fluids[i] = dat.readInt());
|
||||||
((TEAltarMessage) msg).fluids[i] = dat.readInt();
|
|
||||||
|
m.capacity = dat.readInt();
|
||||||
|
}
|
||||||
|
case 1 -> {
|
||||||
|
TEOrientableMessage m = (TEOrientableMessage) msg;
|
||||||
|
m.x = dat.readInt();
|
||||||
|
m.y = dat.readInt();
|
||||||
|
m.z = dat.readInt();
|
||||||
|
|
||||||
|
m.input = dat.readInt();
|
||||||
|
m.output = dat.readInt();
|
||||||
|
}
|
||||||
|
case 2 -> {
|
||||||
|
TEPedestalMessage m = (TEPedestalMessage) msg;
|
||||||
|
m.x = dat.readInt();
|
||||||
|
m.y = dat.readInt();
|
||||||
|
m.z = dat.readInt();
|
||||||
|
|
||||||
|
boolean hasStacks = dat.readBoolean();
|
||||||
|
|
||||||
|
m.items = new int[TEPedestal.sizeInv * 3];
|
||||||
|
if (hasStacks) {
|
||||||
|
m.items = new int[TEPedestal.sizeInv * 3];
|
||||||
|
IntStream.range(0, m.items.length).forEach(i -> m.items[i] = dat.readInt());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 3 -> {
|
||||||
|
TEPlinthMessage m = (TEPlinthMessage) msg;
|
||||||
|
m.x = dat.readInt();
|
||||||
|
m.y = dat.readInt();
|
||||||
|
m.z = dat.readInt();
|
||||||
|
|
||||||
((TEAltarMessage) msg).capacity = dat.readInt();
|
boolean hasStacks = dat.readBoolean();
|
||||||
|
|
||||||
break;
|
m.items = new int[TEPlinth.sizeInv * 3];
|
||||||
|
if (hasStacks) {
|
||||||
case 1:
|
m.items = new int[TEPlinth.sizeInv * 3];
|
||||||
((TEOrientableMessage) msg).x = dat.readInt();
|
IntStream.range(0, m.items.length).forEach(i -> m.items[i] = dat.readInt());
|
||||||
((TEOrientableMessage) msg).y = dat.readInt();
|
|
||||||
((TEOrientableMessage) msg).z = dat.readInt();
|
|
||||||
|
|
||||||
((TEOrientableMessage) msg).input = dat.readInt();
|
|
||||||
((TEOrientableMessage) msg).output = dat.readInt();
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
((TEPedestalMessage) msg).x = dat.readInt();
|
|
||||||
((TEPedestalMessage) msg).y = dat.readInt();
|
|
||||||
((TEPedestalMessage) msg).z = dat.readInt();
|
|
||||||
|
|
||||||
boolean hasStacks1 = dat.readBoolean();
|
|
||||||
|
|
||||||
((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3];
|
|
||||||
if (hasStacks1) {
|
|
||||||
((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3];
|
|
||||||
for (int i = 0; i < ((TEPedestalMessage) msg).items.length; i++) {
|
|
||||||
((TEPedestalMessage) msg).items[i] = dat.readInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 4 -> {
|
||||||
|
TESocketMessage m = (TESocketMessage) msg;
|
||||||
|
m.x = dat.readInt();
|
||||||
|
m.y = dat.readInt();
|
||||||
|
m.z = dat.readInt();
|
||||||
|
|
||||||
break;
|
boolean hasStacks = dat.readBoolean();
|
||||||
|
|
||||||
case 3:
|
m.items = new int[TESocket.sizeInv * 3];
|
||||||
((TEPlinthMessage) msg).x = dat.readInt();
|
if (hasStacks) {
|
||||||
((TEPlinthMessage) msg).y = dat.readInt();
|
m.items = new int[TESocket.sizeInv * 3];
|
||||||
((TEPlinthMessage) msg).z = dat.readInt();
|
IntStream.range(0, m.items.length).forEach(i -> m.items[i] = dat.readInt());
|
||||||
|
|
||||||
boolean hasStacks2 = dat.readBoolean();
|
|
||||||
|
|
||||||
((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3];
|
|
||||||
if (hasStacks2) {
|
|
||||||
((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3];
|
|
||||||
for (int i = 0; i < ((TEPlinthMessage) msg).items.length; i++) {
|
|
||||||
((TEPlinthMessage) msg).items[i] = dat.readInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 5 -> {
|
||||||
|
TETeleposerMessage m = (TETeleposerMessage) msg;
|
||||||
|
m.x = dat.readInt();
|
||||||
|
m.y = dat.readInt();
|
||||||
|
m.z = dat.readInt();
|
||||||
|
|
||||||
break;
|
boolean hasStacks = dat.readBoolean();
|
||||||
|
|
||||||
case 4:
|
m.items = new int[TETeleposer.sizeInv * 3];
|
||||||
((TESocketMessage) msg).x = dat.readInt();
|
if (hasStacks) {
|
||||||
((TESocketMessage) msg).y = dat.readInt();
|
m.items = new int[TETeleposer.sizeInv * 3];
|
||||||
((TESocketMessage) msg).z = dat.readInt();
|
IntStream.range(0, m.items.length).forEach(i -> m.items[i] = dat.readInt());
|
||||||
|
|
||||||
boolean hasStacks3 = dat.readBoolean();
|
|
||||||
|
|
||||||
((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3];
|
|
||||||
if (hasStacks3) {
|
|
||||||
((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3];
|
|
||||||
for (int i = 0; i < ((TESocketMessage) msg).items.length; i++) {
|
|
||||||
((TESocketMessage) msg).items[i] = dat.readInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 6 -> {
|
||||||
|
TEWritingTableMessage m = (TEWritingTableMessage) msg;
|
||||||
|
m.x = dat.readInt();
|
||||||
|
m.y = dat.readInt();
|
||||||
|
m.z = dat.readInt();
|
||||||
|
|
||||||
break;
|
boolean hasStacks = dat.readBoolean();
|
||||||
|
|
||||||
case 5:
|
m.items = new int[TEWritingTable.sizeInv * 3];
|
||||||
((TETeleposerMessage) msg).x = dat.readInt();
|
if (hasStacks) {
|
||||||
((TETeleposerMessage) msg).y = dat.readInt();
|
m.items = new int[TEWritingTable.sizeInv * 3];
|
||||||
((TETeleposerMessage) msg).z = dat.readInt();
|
IntStream.range(0, m.items.length).forEach(i -> m.items[i] = dat.readInt());
|
||||||
|
|
||||||
boolean hasStacks4 = dat.readBoolean();
|
|
||||||
|
|
||||||
((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3];
|
|
||||||
if (hasStacks4) {
|
|
||||||
((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3];
|
|
||||||
for (int i = 0; i < ((TETeleposerMessage) msg).items.length; i++) {
|
|
||||||
((TETeleposerMessage) msg).items[i] = dat.readInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 7 -> {
|
||||||
|
String str = IntStream.range(0, dat.readInt()).mapToObj(i -> String.valueOf(dat.readChar()))
|
||||||
|
.collect(Collectors.joining());
|
||||||
|
|
||||||
break;
|
ParticleMessage m = (ParticleMessage) msg;
|
||||||
|
m.particle = str;
|
||||||
|
|
||||||
case 6:
|
m.xCoord = dat.readDouble();
|
||||||
((TEWritingTableMessage) msg).x = dat.readInt();
|
m.yCoord = dat.readDouble();
|
||||||
((TEWritingTableMessage) msg).y = dat.readInt();
|
m.zCoord = dat.readDouble();
|
||||||
((TEWritingTableMessage) msg).z = dat.readInt();
|
|
||||||
|
|
||||||
boolean hasStacks5 = dat.readBoolean();
|
m.xVel = dat.readDouble();
|
||||||
|
m.yVel = dat.readDouble();
|
||||||
|
m.zVel = dat.readDouble();
|
||||||
|
}
|
||||||
|
case 8 -> {
|
||||||
|
VelocityMessage m = (VelocityMessage) msg;
|
||||||
|
m.xVel = dat.readDouble();
|
||||||
|
m.yVel = dat.readDouble();
|
||||||
|
m.zVel = dat.readDouble();
|
||||||
|
}
|
||||||
|
case 9 -> {
|
||||||
|
TEMasterStoneMessage m = (TEMasterStoneMessage) msg;
|
||||||
|
m.x = dat.readInt();
|
||||||
|
m.y = dat.readInt();
|
||||||
|
m.z = dat.readInt();
|
||||||
|
|
||||||
((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3];
|
m.ritual = IntStream.range(0, dat.readInt()).mapToObj(i -> String.valueOf(dat.readChar()))
|
||||||
if (hasStacks5) {
|
.collect(Collectors.joining());
|
||||||
((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3];
|
m.isRunning = dat.readBoolean();
|
||||||
for (int i = 0; i < ((TEWritingTableMessage) msg).items.length; i++) {
|
}
|
||||||
((TEWritingTableMessage) msg).items[i] = dat.readInt();
|
case 10 -> {
|
||||||
}
|
TEReagentConduitMessage m = (TEReagentConduitMessage) msg;
|
||||||
}
|
m.x = dat.readInt();
|
||||||
|
m.y = dat.readInt();
|
||||||
break;
|
m.z = dat.readInt();
|
||||||
|
|
||||||
case 7:
|
|
||||||
int size = dat.readInt();
|
|
||||||
String str = "";
|
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
|
||||||
str = str + dat.readChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
((ParticleMessage) msg).particle = str;
|
|
||||||
|
|
||||||
((ParticleMessage) msg).xCoord = dat.readDouble();
|
|
||||||
((ParticleMessage) msg).yCoord = dat.readDouble();
|
|
||||||
((ParticleMessage) msg).zCoord = dat.readDouble();
|
|
||||||
|
|
||||||
((ParticleMessage) msg).xVel = dat.readDouble();
|
|
||||||
((ParticleMessage) msg).yVel = dat.readDouble();
|
|
||||||
((ParticleMessage) msg).zVel = dat.readDouble();
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
((VelocityMessage) msg).xVel = dat.readDouble();
|
|
||||||
((VelocityMessage) msg).yVel = dat.readDouble();
|
|
||||||
((VelocityMessage) msg).zVel = dat.readDouble();
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
((TEMasterStoneMessage) msg).x = dat.readInt();
|
|
||||||
((TEMasterStoneMessage) msg).y = dat.readInt();
|
|
||||||
((TEMasterStoneMessage) msg).z = dat.readInt();
|
|
||||||
|
|
||||||
int ritualStrSize = dat.readInt();
|
|
||||||
String ritual = "";
|
|
||||||
|
|
||||||
for (int i = 0; i < ritualStrSize; i++) {
|
|
||||||
ritual = ritual + dat.readChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
((TEMasterStoneMessage) msg).ritual = ritual;
|
|
||||||
((TEMasterStoneMessage) msg).isRunning = dat.readBoolean();
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
((TEReagentConduitMessage) msg).x = dat.readInt();
|
|
||||||
((TEReagentConduitMessage) msg).y = dat.readInt();
|
|
||||||
((TEReagentConduitMessage) msg).z = dat.readInt();
|
|
||||||
|
|
||||||
int listSize = dat.readInt();
|
int listSize = dat.readInt();
|
||||||
|
|
||||||
List<ColourAndCoords> list = new LinkedList();
|
m.destinationList = IntStream.range(0, listSize)
|
||||||
|
.mapToObj(
|
||||||
for (int i = 0; i < listSize; i++) {
|
i -> new ColourAndCoords(
|
||||||
list.add(
|
dat.readInt(),
|
||||||
new ColourAndCoords(
|
dat.readInt(),
|
||||||
dat.readInt(),
|
dat.readInt(),
|
||||||
dat.readInt(),
|
dat.readInt(),
|
||||||
dat.readInt(),
|
dat.readInt(),
|
||||||
dat.readInt(),
|
dat.readInt(),
|
||||||
dat.readInt(),
|
dat.readInt()))
|
||||||
dat.readInt(),
|
.collect(Collectors.toCollection(LinkedList::new));
|
||||||
dat.readInt()));
|
}
|
||||||
}
|
case 11 -> {
|
||||||
|
CurrentLPMessage m = (CurrentLPMessage) msg;
|
||||||
((TEReagentConduitMessage) msg).destinationList = list;
|
m.currentLP = dat.readInt();
|
||||||
|
m.maxLP = dat.readInt();
|
||||||
break;
|
}
|
||||||
|
case 12 -> {
|
||||||
case 11:
|
CurrentReagentBarMessage m = (CurrentReagentBarMessage) msg;
|
||||||
((CurrentLPMessage) msg).currentLP = dat.readInt();
|
m.reagent = IntStream.range(0, dat.readInt()).mapToObj(i -> String.valueOf(dat.readChar()))
|
||||||
((CurrentLPMessage) msg).maxLP = dat.readInt();
|
.collect(Collectors.joining());
|
||||||
|
m.currentAR = dat.readFloat();
|
||||||
break;
|
m.maxAR = dat.readFloat();
|
||||||
|
}
|
||||||
case 12:
|
case 13 -> {
|
||||||
int size1 = dat.readInt();
|
CurrentAddedHPMessage m = (CurrentAddedHPMessage) msg;
|
||||||
String str1 = "";
|
m.currentHP = dat.readFloat();
|
||||||
for (int i = 0; i < size1; i++) {
|
m.maxHP = dat.readFloat();
|
||||||
str1 = str1 + dat.readChar();
|
}
|
||||||
}
|
case 14 -> ((KeyboardMessage) msg).keyPressed = dat.readByte();
|
||||||
|
case 15 -> {
|
||||||
((CurrentReagentBarMessage) msg).reagent = str1;
|
GaiaBiomeChangeMessage m = (GaiaBiomeChangeMessage) msg;
|
||||||
((CurrentReagentBarMessage) msg).currentAR = dat.readFloat();
|
m.chunkX = dat.readInt();
|
||||||
((CurrentReagentBarMessage) msg).maxAR = dat.readFloat();
|
m.chunkZ = dat.readInt();
|
||||||
|
m.biome = dat.readByte();
|
||||||
break;
|
|
||||||
|
|
||||||
case 13:
|
|
||||||
((CurrentAddedHPMessage) msg).currentHP = dat.readFloat();
|
|
||||||
((CurrentAddedHPMessage) msg).maxHP = dat.readFloat();
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 14:
|
|
||||||
System.out.println("Packet recieved: being decoded");
|
|
||||||
((KeyboardMessage) msg).keyPressed = dat.readByte();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
((GaiaBiomeChangeMessage) msg).chunkX = dat.readInt();
|
|
||||||
((GaiaBiomeChangeMessage) msg).chunkZ = dat.readInt();
|
|
||||||
((GaiaBiomeChangeMessage) msg).biome = dat.readByte();
|
|
||||||
|
|
||||||
byte[] buffer = new byte[GaiaBiomeChangeMessage.maskByteCount];
|
byte[] buffer = new byte[GaiaBiomeChangeMessage.maskByteCount];
|
||||||
dat.readBytes(buffer);
|
dat.readBytes(buffer);
|
||||||
((GaiaBiomeChangeMessage) msg).mask = BitSet.valueOf(buffer);
|
m.mask = BitSet.valueOf(buffer);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -972,8 +839,8 @@ public enum NewPacketHandler {
|
|||||||
msg.x = tileOrientable.xCoord;
|
msg.x = tileOrientable.xCoord;
|
||||||
msg.y = tileOrientable.yCoord;
|
msg.y = tileOrientable.yCoord;
|
||||||
msg.z = tileOrientable.zCoord;
|
msg.z = tileOrientable.zCoord;
|
||||||
msg.input = tileOrientable.getIntForForgeDirection(tileOrientable.getInputDirection());
|
msg.input = TEOrientable.getIntForForgeDirection(tileOrientable.getInputDirection());
|
||||||
msg.output = tileOrientable.getIntForForgeDirection(tileOrientable.getOutputDirection());
|
msg.output = TEOrientable.getIntForForgeDirection(tileOrientable.getOutputDirection());
|
||||||
|
|
||||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||||
}
|
}
|
||||||
@@ -1116,8 +983,6 @@ public enum NewPacketHandler {
|
|||||||
msg.index = 14;
|
msg.index = 14;
|
||||||
msg.keyPressed = bt;
|
msg.keyPressed = bt;
|
||||||
|
|
||||||
System.out.println("Packet is being created");
|
|
||||||
|
|
||||||
return INSTANCE.channels.get(Side.CLIENT).generatePacketFrom(msg);
|
return INSTANCE.channels.get(Side.CLIENT).generatePacketFrom(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import java.util.Random;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.BlockMobSpawner;
|
|
||||||
import net.minecraft.block.BlockPortal;
|
import net.minecraft.block.BlockPortal;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -21,13 +20,13 @@ import net.minecraftforge.common.MinecraftForge;
|
|||||||
|
|
||||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||||
import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
|
import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
|
||||||
|
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||||
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
|
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
||||||
import codechicken.multipart.MultipartHelper;
|
import codechicken.multipart.MultipartHelper;
|
||||||
import codechicken.multipart.TileMultipart;
|
import codechicken.multipart.TileMultipart;
|
||||||
import cpw.mods.fml.common.Optional;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@@ -37,10 +36,7 @@ public class BlockTeleposer extends BlockContainer {
|
|||||||
private IIcon topIcon;
|
private IIcon topIcon;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon sideIcon2;
|
private IIcon sideIcon;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private IIcon bottomIcon;
|
|
||||||
|
|
||||||
public BlockTeleposer() {
|
public BlockTeleposer() {
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
@@ -54,18 +50,14 @@ public class BlockTeleposer extends BlockContainer {
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return switch (side) {
|
if (side == 1) return topIcon;
|
||||||
case 0 -> bottomIcon;
|
return sideIcon;
|
||||||
case 1 -> topIcon;
|
|
||||||
default -> sideIcon2;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,23 +65,18 @@ public class BlockTeleposer extends BlockContainer {
|
|||||||
float these, float are) {
|
float these, float are) {
|
||||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||||
|
|
||||||
if (playerItem != null) {
|
if (playerItem == null || !(playerItem.getItem() instanceof TelepositionFocus)) {
|
||||||
if (playerItem.getItem() instanceof TelepositionFocus) {
|
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
|
||||||
SoulNetworkHandler.checkAndSetItemPlayer(playerItem, player);
|
return true;
|
||||||
|
|
||||||
if (playerItem.getTagCompound() == null) {
|
|
||||||
playerItem.setTagCompound(new NBTTagCompound());
|
|
||||||
}
|
|
||||||
|
|
||||||
NBTTagCompound itemTag = playerItem.getTagCompound();
|
|
||||||
itemTag.setInteger("xCoord", x);
|
|
||||||
itemTag.setInteger("yCoord", y);
|
|
||||||
itemTag.setInteger("zCoord", z);
|
|
||||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
|
|
||||||
|
SoulNetworkHandler.checkAndSetItemPlayer(playerItem, player);
|
||||||
|
|
||||||
|
NBTTagCompound itemTag = IBindable.getTag(playerItem);
|
||||||
|
itemTag.setInteger("xCoord", x);
|
||||||
|
itemTag.setInteger("yCoord", y);
|
||||||
|
itemTag.setInteger("zCoord", z);
|
||||||
|
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,38 +90,36 @@ public class BlockTeleposer extends BlockContainer {
|
|||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if (!(tileEntity instanceof IInventory)) {
|
if (!(tileEntity instanceof IInventory inventory)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IInventory inventory = (IInventory) tileEntity;
|
ItemStack item = inventory.getStackInSlot(0);
|
||||||
|
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
if (item == null || item.stackSize <= 0) {
|
||||||
ItemStack item = inventory.getStackInSlot(i);
|
return;
|
||||||
|
|
||||||
if (item != null && item.stackSize > 0) {
|
|
||||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
EntityItem entityItem = new EntityItem(
|
|
||||||
world,
|
|
||||||
x + rx,
|
|
||||||
y + ry,
|
|
||||||
z + rz,
|
|
||||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
|
||||||
|
|
||||||
if (item.hasTagCompound()) {
|
|
||||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
|
||||||
}
|
|
||||||
|
|
||||||
float factor = 0.05F;
|
|
||||||
entityItem.motionX = rand.nextGaussian() * factor;
|
|
||||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
|
||||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
|
||||||
world.spawnEntityInWorld(entityItem);
|
|
||||||
item.stackSize = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
EntityItem entityItem = new EntityItem(
|
||||||
|
world,
|
||||||
|
x + rx,
|
||||||
|
y + ry,
|
||||||
|
z + rz,
|
||||||
|
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||||
|
|
||||||
|
if (item.hasTagCompound()) {
|
||||||
|
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||||
|
}
|
||||||
|
|
||||||
|
float factor = 0.05F;
|
||||||
|
entityItem.motionX = rand.nextGaussian() * factor;
|
||||||
|
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||||
|
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||||
|
world.spawnEntityInWorld(entityItem);
|
||||||
|
item.stackSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -142,126 +127,93 @@ public class BlockTeleposer extends BlockContainer {
|
|||||||
return new TETeleposer();
|
return new TETeleposer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf,
|
public static boolean swapBlocks(Object caller, World worldA, World worldB, int xA, int yA, int zA, int xB, int yB,
|
||||||
int zf) {
|
int zB) {
|
||||||
return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, true, 3);
|
return swapBlocks(caller, worldA, worldB, xA, yA, zA, xB, yB, zB, true, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean swapBlocksWithoutSound(Object caller, World worldI, World worldF, int xi, int yi, int zi,
|
public static boolean swapBlocksWithoutSound(Object caller, World worldA, World worldB, int xA, int yA, int zA,
|
||||||
int xf, int yf, int zf) {
|
int xB, int yB, int zB) {
|
||||||
return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, false, 3);
|
return swapBlocks(caller, worldA, worldB, xA, yA, zA, xB, yB, zB, false, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf,
|
public static boolean swapBlocks(Object caller, World worldA, World worldB, int xA, int yA, int zA, int xB, int yB,
|
||||||
int zf, boolean doSound, int flag) {
|
int zB, boolean doSound, int flag) {
|
||||||
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
|
TileEntity tileA = worldA.getTileEntity(xA, yA, zA);
|
||||||
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
|
TileEntity tileB = worldB.getTileEntity(xB, yB, zB);
|
||||||
|
|
||||||
NBTTagCompound nbttag1 = new NBTTagCompound();
|
NBTTagCompound nbtA = new NBTTagCompound();
|
||||||
NBTTagCompound nbttag2 = new NBTTagCompound();
|
NBTTagCompound nbtB = new NBTTagCompound();
|
||||||
|
|
||||||
if (tileEntityI != null) {
|
if (tileA != null) tileA.writeToNBT(nbtA);
|
||||||
tileEntityI.writeToNBT(nbttag1);
|
if (tileB != null) tileB.writeToNBT(nbtB);
|
||||||
}
|
|
||||||
|
|
||||||
if (tileEntityF != null) {
|
Block blockA = worldA.getBlock(xA, yA, zA);
|
||||||
tileEntityF.writeToNBT(nbttag2);
|
Block blockB = worldB.getBlock(xB, yB, zB);
|
||||||
}
|
|
||||||
|
|
||||||
Block blockI = worldI.getBlock(xi, yi, zi);
|
if (blockA.equals(Blocks.air) && blockB.equals(Blocks.air)) return false;
|
||||||
Block blockF = worldF.getBlock(xf, yf, zf);
|
|
||||||
|
|
||||||
if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air)) {
|
if (!(caller instanceof TEDemonPortal) && (blockA instanceof BlockPortal || blockB instanceof BlockPortal))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (blockI instanceof BlockMobSpawner || blockF instanceof BlockMobSpawner || caller instanceof TEDemonPortal
|
int metaA = worldA.getBlockMetadata(xA, yA, zA);
|
||||||
? false
|
int metaB = worldB.getBlockMetadata(xB, yB, zB);
|
||||||
: blockI instanceof BlockPortal || blockF instanceof BlockPortal) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int metaI = worldI.getBlockMetadata(xi, yi, zi);
|
TeleposeEvent evt = new TeleposeEvent(worldA, xA, yA, zA, blockA, metaA, worldB, xB, yB, zB, blockB, metaB);
|
||||||
int metaF = worldF.getBlockMetadata(xf, yf, zf);
|
|
||||||
|
|
||||||
TeleposeEvent evt = new TeleposeEvent(worldI, xi, yi, zi, blockI, metaI, worldF, xf, yf, zf, blockF, metaF);
|
|
||||||
if (MinecraftForge.EVENT_BUS.post(evt)) return false;
|
if (MinecraftForge.EVENT_BUS.post(evt)) return false;
|
||||||
|
|
||||||
if (doSound) {
|
if (doSound) {
|
||||||
worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F);
|
String sound = "mob.endermen.portal";
|
||||||
worldF.playSoundEffect(xf, yf, zf, "mob.endermen.portal", 1.0F, 1.0F);
|
worldA.playSoundEffect(xA, yA, zA, sound, 1.0F, 1.0F);
|
||||||
|
worldB.playSoundEffect(xB, yB, zB, sound, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CLEAR TILES
|
// Clear current tile entities
|
||||||
Block finalBlock = blockF;
|
worldB.setTileEntity(xB, yB, zB, blockB.createTileEntity(worldB, metaB));
|
||||||
|
worldA.setTileEntity(xA, yA, zA, blockA.createTileEntity(worldA, metaA));
|
||||||
|
|
||||||
if (finalBlock != null) {
|
// Swap blocks
|
||||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, metaF);
|
worldB.setBlock(xB, yB, zB, blockA, metaA, flag);
|
||||||
|
worldA.setBlock(xA, yA, zA, blockB, metaB, flag);
|
||||||
|
|
||||||
worldF.setTileEntity(xf, yf, zf, tileToSet);
|
// Restore tile entities
|
||||||
}
|
swapTile(worldB, xB, yB, zB, tileA, nbtA);
|
||||||
|
swapTile(worldA, xA, yA, zA, tileB, nbtB);
|
||||||
if (blockI != null) {
|
|
||||||
TileEntity tileToSet = blockI.createTileEntity(worldI, metaI);
|
|
||||||
|
|
||||||
worldI.setTileEntity(xi, yi, zi, tileToSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TILES CLEARED
|
|
||||||
worldF.setBlock(xf, yf, zf, blockI, metaI, flag);
|
|
||||||
|
|
||||||
if (tileEntityI != null) {
|
|
||||||
TileEntity newTileEntityI = TileEntity.createAndLoadEntity(nbttag1);
|
|
||||||
|
|
||||||
if (AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI)) {
|
|
||||||
newTileEntityI = createMultipartFromNBT(worldF, nbttag1);
|
|
||||||
}
|
|
||||||
|
|
||||||
worldF.setTileEntity(xf, yf, zf, newTileEntityI);
|
|
||||||
|
|
||||||
newTileEntityI.xCoord = xf;
|
|
||||||
newTileEntityI.yCoord = yf;
|
|
||||||
newTileEntityI.zCoord = zf;
|
|
||||||
|
|
||||||
if (AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI)) {
|
|
||||||
sendDescriptorOfTile(worldF, newTileEntityI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
worldI.setBlock(xi, yi, zi, finalBlock, metaF, flag);
|
|
||||||
|
|
||||||
if (tileEntityF != null) {
|
|
||||||
TileEntity newTileEntityF = TileEntity.createAndLoadEntity(nbttag2);
|
|
||||||
if (AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF)) {
|
|
||||||
newTileEntityF = createMultipartFromNBT(worldI, nbttag2);
|
|
||||||
}
|
|
||||||
|
|
||||||
worldI.setTileEntity(xi, yi, zi, newTileEntityF);
|
|
||||||
|
|
||||||
newTileEntityF.xCoord = xi;
|
|
||||||
newTileEntityF.yCoord = yi;
|
|
||||||
newTileEntityF.zCoord = zi;
|
|
||||||
|
|
||||||
if (AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF)) {
|
|
||||||
sendDescriptorOfTile(worldI, newTileEntityF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Optional.Method(modid = "ForgeMultipart")
|
private static void swapTile(World world, int x, int y, int z, TileEntity oldTile, NBTTagCompound nbt) {
|
||||||
public static boolean isMultipart(TileEntity tile) {
|
if (oldTile == null) return;
|
||||||
return tile instanceof TileMultipart;
|
|
||||||
|
TileEntity newTile;
|
||||||
|
|
||||||
|
boolean multipart = AlchemicalWizardry.isFMPLoaded && oldTile instanceof TileMultipart;
|
||||||
|
if (multipart) {
|
||||||
|
newTile = MultipartHelper.createTileFromNBT(world, nbt);
|
||||||
|
} else {
|
||||||
|
newTile = TileEntity.createAndLoadEntity(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
world.setTileEntity(x, y, z, newTile);
|
||||||
|
|
||||||
|
newTile.xCoord = x;
|
||||||
|
newTile.yCoord = y;
|
||||||
|
newTile.zCoord = z;
|
||||||
|
|
||||||
|
if (multipart) MultipartHelper.sendDescPacket(world, newTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Optional.Method(modid = "ForgeMultipart")
|
@Override
|
||||||
public static TileEntity createMultipartFromNBT(World world, NBTTagCompound tag) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
|
||||||
return MultipartHelper.createTileFromNBT(world, tag);
|
if (!(world.getTileEntity(x, y, z) instanceof TETeleposer teleposer)) return;
|
||||||
}
|
// was it a low->high pulse
|
||||||
|
boolean isPowered = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||||
@Optional.Method(modid = "ForgeMultipart")
|
if (!teleposer.hasRedstone && isPowered) {
|
||||||
public static void sendDescriptorOfTile(World world, TileEntity tile) {
|
teleposer.hasRedstone = true;
|
||||||
MultipartHelper.sendDescPacket(world, tile);
|
teleposer.activate();
|
||||||
|
} else {
|
||||||
|
teleposer.hasRedstone = isPowered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,25 +133,26 @@ public class EnergyItems extends Item implements IBindable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canSyphonInContainer(ItemStack ist, int damageToBeDone) {
|
public static boolean canSyphonInContainer(ItemStack ist, int damageToBeDone) {
|
||||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) {
|
if (!(ist.getItem() instanceof IBindable)) {
|
||||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
return false;
|
||||||
|
|
||||||
if (MinecraftServer.getServer() == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
World world = MinecraftServer.getServer().worldServers[0];
|
|
||||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
|
||||||
|
|
||||||
if (data == null) {
|
|
||||||
data = new LifeEssenceNetwork(ownerName);
|
|
||||||
world.setItemData(ownerName, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data.currentEssence >= damageToBeDone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
String ownerName = IBindable.getOwnerName(ist);
|
||||||
|
MinecraftServer server = MinecraftServer.getServer();
|
||||||
|
|
||||||
|
if (ownerName.isEmpty() || server == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
World world = server.worldServers[0];
|
||||||
|
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||||
|
|
||||||
|
if (data == null) {
|
||||||
|
data = new LifeEssenceNetwork(ownerName);
|
||||||
|
world.setItemData(ownerName, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.currentEssence >= damageToBeDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void hurtPlayer(EntityPlayer user, int energySyphoned) {
|
public static void hurtPlayer(EntityPlayer user, int energySyphoned) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
|
|
||||||
public class TelepositionFocus extends EnergyItems {
|
public class TelepositionFocus extends EnergyItems {
|
||||||
|
|
||||||
private int focusLevel;
|
private final int focusLevel;
|
||||||
|
|
||||||
public TelepositionFocus(int focusLevel) {
|
public TelepositionFocus(int focusLevel) {
|
||||||
super();
|
super();
|
||||||
@@ -33,7 +33,8 @@ public class TelepositionFocus extends EnergyItems {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List,
|
||||||
|
boolean par4) {
|
||||||
par3List.add(StatCollector.translateToLocal("tooltip.telepositionfocus.desc"));
|
par3List.add(StatCollector.translateToLocal("tooltip.telepositionfocus.desc"));
|
||||||
addBindingInformation(par1ItemStack, par3List);
|
addBindingInformation(par1ItemStack, par3List);
|
||||||
|
|
||||||
@@ -50,20 +51,12 @@ public class TelepositionFocus extends EnergyItems {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||||
if (par3EntityPlayer.isSneaking()) {
|
|
||||||
return par1ItemStack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return par1ItemStack;
|
return par1ItemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDimensionID(ItemStack itemStack) {
|
public int getDimensionID(ItemStack itemStack) {
|
||||||
if (itemStack.getTagCompound() == null) {
|
return IBindable.getTag(itemStack).getInteger("dimensionId");
|
||||||
itemStack.setTagCompound(new NBTTagCompound());
|
|
||||||
}
|
|
||||||
|
|
||||||
return itemStack.getTagCompound().getInteger("dimensionId");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld(ItemStack itemStack) {
|
public World getWorld(ItemStack itemStack) {
|
||||||
@@ -72,27 +65,15 @@ public class TelepositionFocus extends EnergyItems {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int xCoord(ItemStack itemStack) {
|
public int xCoord(ItemStack itemStack) {
|
||||||
if (!(itemStack.getTagCompound() == null)) {
|
return IBindable.getTag(itemStack).getInteger("xCoord");
|
||||||
return itemStack.getTagCompound().getInteger("xCoord");
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int yCoord(ItemStack itemStack) {
|
public int yCoord(ItemStack itemStack) {
|
||||||
if (!(itemStack.getTagCompound() == null)) {
|
return IBindable.getTag(itemStack).getInteger("yCoord");
|
||||||
return itemStack.getTagCompound().getInteger("yCoord");
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int zCoord(ItemStack itemStack) {
|
public int zCoord(ItemStack itemStack) {
|
||||||
if (!(itemStack.getTagCompound() == null)) {
|
return IBindable.getTag(itemStack).getInteger("zCoord");
|
||||||
return itemStack.getTagCompound().getInteger("zCoord");
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFocusLevel() {
|
public int getFocusLevel() {
|
||||||
|
|||||||
+88
-87
@@ -1,7 +1,6 @@
|
|||||||
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
|
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -26,17 +25,15 @@ import net.minecraft.item.crafting.FurnaceRecipes;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.network.play.server.S06PacketUpdateHealth;
|
import net.minecraft.network.play.server.S06PacketUpdateHealth;
|
||||||
import net.minecraft.network.play.server.S07PacketRespawn;
|
|
||||||
import net.minecraft.network.play.server.S1DPacketEntityEffect;
|
|
||||||
import net.minecraft.network.play.server.S1FPacketSetExperience;
|
import net.minecraft.network.play.server.S1FPacketSetExperience;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
import net.minecraft.potion.PotionEffect;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.management.ServerConfigurationManager;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.ChatComponentTranslation;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.Teleporter;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
@@ -52,7 +49,6 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
|||||||
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||||
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
||||||
import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination;
|
import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
|
|
||||||
public class SpellHelper {
|
public class SpellHelper {
|
||||||
|
|
||||||
@@ -756,89 +752,64 @@ public class SpellHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adapated from Enhanced Portals 3 code
|
public static void teleportEntityToDim(World oldWorld, int newWorldID, double x, double y, double z,
|
||||||
public static Entity teleportEntityToDim(World oldWorld, int newWorldID, double d, double e, double f,
|
|
||||||
Entity entity) {
|
Entity entity) {
|
||||||
if (entity != null) {
|
if (entity == null || entity.timeUntilPortal > 0) return;
|
||||||
if (entity.timeUntilPortal <= 0) {
|
|
||||||
WorldServer oldWorldServer = MinecraftServer.getServer().worldServerForDimension(entity.dimension);
|
MinecraftServer server = MinecraftServer.getServer();
|
||||||
WorldServer newWorldServer = MinecraftServer.getServer().worldServerForDimension(newWorldID);
|
WorldServer oldWorldServer = server.worldServerForDimension(entity.dimension);
|
||||||
if (entity instanceof EntityPlayer) {
|
WorldServer newWorldServer = server.worldServerForDimension(newWorldID);
|
||||||
EntityPlayerMP player = (EntityPlayerMP) entity;
|
|
||||||
if (!player.worldObj.isRemote) {
|
oldWorld.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
|
||||||
player.worldObj.theProfiler.startSection("portal");
|
|
||||||
player.worldObj.theProfiler.startSection("changeDimension");
|
if (entity instanceof EntityPlayerMP player) {
|
||||||
ServerConfigurationManager config = player.mcServer.getConfigurationManager();
|
teleportPlayer(player, newWorldServer, x, y, z);
|
||||||
oldWorld.playSoundEffect(
|
} else {
|
||||||
player.posX,
|
teleportNonPlayer(entity, oldWorldServer, newWorldServer, x, y, z);
|
||||||
player.posY,
|
|
||||||
player.posZ,
|
|
||||||
"mob.endermen.portal",
|
|
||||||
1.0F,
|
|
||||||
1.0F);
|
|
||||||
player.closeScreen();
|
|
||||||
player.dimension = newWorldServer.provider.dimensionId;
|
|
||||||
player.playerNetServerHandler.sendPacket(
|
|
||||||
new S07PacketRespawn(
|
|
||||||
player.dimension,
|
|
||||||
player.worldObj.difficultySetting,
|
|
||||||
newWorldServer.getWorldInfo().getTerrainType(),
|
|
||||||
player.theItemInWorldManager.getGameType()));
|
|
||||||
oldWorldServer.removeEntity(player);
|
|
||||||
player.isDead = false;
|
|
||||||
player.setLocationAndAngles(d, e, f, player.rotationYaw, player.rotationPitch);
|
|
||||||
newWorldServer.spawnEntityInWorld(player);
|
|
||||||
player.setWorld(newWorldServer);
|
|
||||||
config.func_72375_a(player, oldWorldServer);
|
|
||||||
player.playerNetServerHandler
|
|
||||||
.setPlayerLocation(d, e, f, entity.rotationYaw, entity.rotationPitch);
|
|
||||||
player.theItemInWorldManager.setWorld(newWorldServer);
|
|
||||||
config.updateTimeAndWeatherForPlayer(player, newWorldServer);
|
|
||||||
config.syncPlayerInventory(player);
|
|
||||||
player.worldObj.theProfiler.endSection();
|
|
||||||
oldWorldServer.resetUpdateEntityTick();
|
|
||||||
newWorldServer.resetUpdateEntityTick();
|
|
||||||
player.worldObj.theProfiler.endSection();
|
|
||||||
for (Iterator<PotionEffect> potion = player.getActivePotionEffects().iterator(); potion
|
|
||||||
.hasNext();) {
|
|
||||||
player.playerNetServerHandler
|
|
||||||
.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potion.next()));
|
|
||||||
}
|
|
||||||
player.playerNetServerHandler.sendPacket(
|
|
||||||
new S1FPacketSetExperience(
|
|
||||||
player.experience,
|
|
||||||
player.experienceTotal,
|
|
||||||
player.experienceLevel));
|
|
||||||
FMLCommonHandler.instance().firePlayerChangedDimensionEvent(
|
|
||||||
player,
|
|
||||||
oldWorldServer.provider.dimensionId,
|
|
||||||
player.dimension);
|
|
||||||
player.timeUntilPortal = 150;
|
|
||||||
}
|
|
||||||
player.worldObj.theProfiler.endSection();
|
|
||||||
newWorldServer.playSoundEffect(d, e, f, "mob.endermen.portal", 1.0F, 1.0F);
|
|
||||||
return player;
|
|
||||||
} else {
|
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
|
||||||
entity.writeToNBTOptional(tag);
|
|
||||||
entity.setDead();
|
|
||||||
oldWorld.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
|
|
||||||
Entity teleportedEntity = EntityList.createEntityFromNBT(tag, newWorldServer);
|
|
||||||
if (teleportedEntity != null) {
|
|
||||||
teleportedEntity.setLocationAndAngles(d, e, f, entity.rotationYaw, entity.rotationPitch);
|
|
||||||
teleportedEntity.forceSpawn = true;
|
|
||||||
newWorldServer.spawnEntityInWorld(teleportedEntity);
|
|
||||||
teleportedEntity.setWorld(newWorldServer);
|
|
||||||
teleportedEntity.timeUntilPortal = 150;
|
|
||||||
}
|
|
||||||
oldWorldServer.resetUpdateEntityTick();
|
|
||||||
newWorldServer.resetUpdateEntityTick();
|
|
||||||
newWorldServer.playSoundEffect(d, e, f, "mob.endermen.portal", 1.0F, 1.0F);
|
|
||||||
return teleportedEntity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
newWorldServer.playSoundEffect(x, y, z, "mob.endermen.portal", 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void teleportPlayer(EntityPlayerMP player, WorldServer newWorldServer, double x, double y,
|
||||||
|
double z) {
|
||||||
|
if (player.worldObj.isRemote) return;
|
||||||
|
|
||||||
|
// Teleporting to the Spirit World from Witchery causes the player to get stuck until exiting the world.
|
||||||
|
// Blocks and mobs are fine, so only player TPs need to be canceled.
|
||||||
|
// TODO: Figure out a better fix for this instead of just preventing it.
|
||||||
|
if (newWorldServer.provider.getDimensionName().equals("Spirit World")) {
|
||||||
|
player.addChatComponentMessage(new ChatComponentTranslation("message.warn.spiritWorld"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.mcServer.getConfigurationManager().transferPlayerToDimension(
|
||||||
|
player,
|
||||||
|
newWorldServer.provider.dimensionId,
|
||||||
|
new BMTeleporter(newWorldServer, x, y, z));
|
||||||
|
|
||||||
|
player.timeUntilPortal = 20;
|
||||||
|
player.playerNetServerHandler.sendPacket(
|
||||||
|
new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void teleportNonPlayer(Entity entity, WorldServer oldWorldServer, WorldServer newWorldServer,
|
||||||
|
double x, double y, double z) {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
entity.writeToNBTOptional(tag);
|
||||||
|
entity.setDead();
|
||||||
|
|
||||||
|
Entity newEntity = EntityList.createEntityFromNBT(tag, newWorldServer);
|
||||||
|
if (newEntity != null) {
|
||||||
|
newEntity.setLocationAndAngles(x, y, z, entity.rotationYaw, entity.rotationPitch);
|
||||||
|
newEntity.forceSpawn = true;
|
||||||
|
newWorldServer.spawnEntityInWorld(newEntity);
|
||||||
|
newEntity.setWorld(newWorldServer);
|
||||||
|
newEntity.timeUntilPortal = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
oldWorldServer.resetUpdateEntityTick();
|
||||||
|
newWorldServer.resetUpdateEntityTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) {
|
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) {
|
||||||
@@ -926,4 +897,34 @@ public class SpellHelper {
|
|||||||
|
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class BMTeleporter extends Teleporter {
|
||||||
|
|
||||||
|
private final double x;
|
||||||
|
private final double y;
|
||||||
|
private final double z;
|
||||||
|
|
||||||
|
public BMTeleporter(WorldServer worldServer, double x, double y, double z) {
|
||||||
|
super(worldServer);
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void placeInPortal(Entity entity, double x, double y, double z, float rotationYaw) {
|
||||||
|
entity.setLocationAndAngles(this.x, this.y, this.z, entity.rotationYaw, entity.rotationPitch);
|
||||||
|
entity.motionX = entity.motionY = entity.motionZ = 0.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean placeInExistingPortal(Entity entity, double x, double y, double z, float rotationYaw) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean makePortal(Entity entity) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,17 @@
|
|||||||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||||
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
||||||
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
|
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
|
||||||
@@ -30,16 +29,14 @@ public class TETeleposer extends TEInventory implements IBloodMagicWailaProvider
|
|||||||
|
|
||||||
private int resultID;
|
private int resultID;
|
||||||
private int resultDamage;
|
private int resultDamage;
|
||||||
private int previousInput;
|
|
||||||
|
|
||||||
private boolean isActive;
|
public boolean hasRedstone;
|
||||||
|
|
||||||
public TETeleposer() {
|
public TETeleposer() {
|
||||||
super(sizeInv);
|
super(sizeInv);
|
||||||
resultID = 0;
|
resultID = 0;
|
||||||
resultDamage = 0;
|
resultDamage = 0;
|
||||||
isActive = false;
|
hasRedstone = false;
|
||||||
previousInput = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,8 +45,7 @@ public class TETeleposer extends TEInventory implements IBloodMagicWailaProvider
|
|||||||
|
|
||||||
resultID = par1NBTTagCompound.getInteger("resultID");
|
resultID = par1NBTTagCompound.getInteger("resultID");
|
||||||
resultDamage = par1NBTTagCompound.getInteger("resultDamage");
|
resultDamage = par1NBTTagCompound.getInteger("resultDamage");
|
||||||
isActive = par1NBTTagCompound.getBoolean("isActive");
|
hasRedstone = par1NBTTagCompound.getBoolean("hasRedstone");
|
||||||
previousInput = par1NBTTagCompound.getInteger("previousInput");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,8 +54,7 @@ public class TETeleposer extends TEInventory implements IBloodMagicWailaProvider
|
|||||||
|
|
||||||
par1NBTTagCompound.setInteger("resultID", resultID);
|
par1NBTTagCompound.setInteger("resultID", resultID);
|
||||||
par1NBTTagCompound.setInteger("resultDamage", resultDamage);
|
par1NBTTagCompound.setInteger("resultDamage", resultDamage);
|
||||||
par1NBTTagCompound.setBoolean("isActive", isActive);
|
par1NBTTagCompound.setBoolean("hasRedstone", hasRedstone);
|
||||||
par1NBTTagCompound.setInteger("previousInput", previousInput);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,167 +67,131 @@ public class TETeleposer extends TEInventory implements IBloodMagicWailaProvider
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logic for the actual block is under here
|
public void activate() {
|
||||||
@Override
|
if (worldObj.isRemote) return;
|
||||||
public void updateEntity() {
|
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
if (worldObj.isRemote) {
|
ItemStack focus = this.getStackInSlot(0);
|
||||||
|
|
||||||
|
if (focus == null || !(focus.getItem() instanceof TelepositionFocus focusItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentInput = worldObj.getBlockPowerInput(xCoord, yCoord, zCoord);
|
World targetWorld = focusItem.getWorld(focus);
|
||||||
|
if (targetWorld == null) return;
|
||||||
|
|
||||||
if (previousInput == 0 && currentInput != 0) {
|
int x = focusItem.xCoord(focus);
|
||||||
ItemStack focus = this.getStackInSlot(0);
|
int y = focusItem.yCoord(focus);
|
||||||
|
int z = focusItem.zCoord(focus);
|
||||||
|
|
||||||
if (focus != null && focus.getItem() instanceof TelepositionFocus) {
|
if (!(targetWorld.getTileEntity(x, y, z) instanceof TETeleposer target) || target == this) {
|
||||||
TelepositionFocus focusItem = (TelepositionFocus) (focus.getItem());
|
return;
|
||||||
int xf = focusItem.xCoord(focus);
|
}
|
||||||
int yf = focusItem.yCoord(focus);
|
|
||||||
int zf = focusItem.zCoord(focus);
|
|
||||||
World worldF = focusItem.getWorld(focus);
|
|
||||||
int damage = (int) (0.5f * Math.sqrt(
|
|
||||||
(xCoord - xf) * (xCoord - xf) + (yCoord - yf + 1) * (yCoord - yf + 1)
|
|
||||||
+ (zCoord - zf) * (zCoord - zf)));
|
|
||||||
int focusLevel = focusItem.getFocusLevel();
|
|
||||||
int transportCount = 0;
|
|
||||||
int entityCount = 0;
|
|
||||||
|
|
||||||
if (worldF != null && worldF.getTileEntity(xf, yf, zf) instanceof TETeleposer
|
int damage = (int) (0.5f
|
||||||
&& !worldF.getTileEntity(xf, yf, zf).equals(this)) {
|
* Math.sqrt(Math.pow(xCoord - x, 2) + Math.pow(yCoord - y + 1, 2) + Math.pow(zCoord - z, 2)));
|
||||||
// Prime the teleportation
|
|
||||||
int d0 = focusLevel - 1;
|
|
||||||
AxisAlignedBB axisalignedbb1 = AxisAlignedBB.getBoundingBox(
|
|
||||||
(double) this.xCoord - 0.5,
|
|
||||||
(double) this.yCoord + d0 + 0.5,
|
|
||||||
(double) this.zCoord - 0.5,
|
|
||||||
(double) (this.xCoord + 0.5),
|
|
||||||
(double) (this.yCoord + 1.5 + d0),
|
|
||||||
(double) (this.zCoord + 0.5)).expand(d0, d0, d0);
|
|
||||||
axisalignedbb1.maxY = Math.min((double) this.worldObj.getHeight(), this.yCoord + 2 + d0 + d0);
|
|
||||||
List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb1);
|
|
||||||
Iterator iterator1 = list1.iterator();
|
|
||||||
EntityLivingBase entityplayer1;
|
|
||||||
|
|
||||||
while (iterator1.hasNext()) {
|
int size = focusItem.getFocusLevel();
|
||||||
entityplayer1 = (EntityLivingBase) iterator1.next();
|
|
||||||
entityCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
AxisAlignedBB axisalignedbb2 = AxisAlignedBB
|
List<EntityLivingBase> localEntities = getEntitiesInArea(worldObj, xCoord, yCoord, zCoord, size);
|
||||||
.getBoundingBox(xf - 0.5, yf + d0 + 0.5, zf - 0.5, xf + 0.5, yf + 1.5 + d0, zf + 0.5)
|
List<EntityLivingBase> targetEntities = getEntitiesInArea(targetWorld, x, y, z, size);
|
||||||
.expand(d0, d0, d0);
|
|
||||||
List list2 = worldF.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb2);
|
|
||||||
Iterator iterator2 = list2.iterator();
|
|
||||||
EntityLivingBase entityplayer2;
|
|
||||||
|
|
||||||
while (iterator2.hasNext()) {
|
int entityCount = localEntities.size() + targetEntities.size();
|
||||||
entityplayer2 = (EntityLivingBase) iterator2.next();
|
|
||||||
entityCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EnergyItems.canSyphonInContainer(
|
if (!EnergyItems.canSyphonInContainer(focus, damage * entityCount)) return;
|
||||||
focus,
|
|
||||||
damage * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1)
|
|
||||||
+ damage * entityCount)) {
|
|
||||||
for (int k = 0; k <= (focusLevel * 2 - 2); k++)
|
|
||||||
for (int i = -(focusLevel - 1); i <= (focusLevel - 1); i++) {
|
|
||||||
for (int j = -(focusLevel - 1); j <= (focusLevel - 1); j++) {
|
|
||||||
{
|
|
||||||
if (BlockTeleposer.swapBlocks(
|
|
||||||
this,
|
|
||||||
worldObj,
|
|
||||||
worldF,
|
|
||||||
xCoord + i,
|
|
||||||
yCoord + 1 + k,
|
|
||||||
zCoord + j,
|
|
||||||
xf + i,
|
|
||||||
yf + 1 + k,
|
|
||||||
zf + j)) {
|
|
||||||
transportCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!worldF.equals(worldObj)) {
|
int movedBlocks = moveBlocks(size, targetWorld, x, y, z);
|
||||||
entityCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Teleport with minimum cost of 2000 LP.
|
int cost = Math.max(damage * movedBlocks + damage * entityCount, 2000);
|
||||||
int cost = Math.max(damage * transportCount + damage * entityCount, 2000);
|
|
||||||
SoulNetworkHandler.syphonFromNetwork(focus, cost);
|
|
||||||
|
|
||||||
if (worldF.equals(worldObj)) {
|
SoulNetworkHandler.syphonFromNetwork(focus, cost);
|
||||||
iterator1 = list1.iterator();
|
|
||||||
iterator2 = list2.iterator();
|
|
||||||
|
|
||||||
while (iterator1.hasNext()) {
|
if (targetWorld.equals(worldObj)) {
|
||||||
entityplayer1 = (EntityLivingBase) iterator1.next();
|
teleportEntitiesSameWorld(localEntities, this.xCoord, this.yCoord, this.zCoord, x, y, z);
|
||||||
entityplayer1.worldObj = worldF;
|
teleportEntitiesSameWorld(targetEntities, x, y, z, this.xCoord, this.yCoord, this.zCoord);
|
||||||
entityplayer1.setPositionAndUpdate(
|
} else {
|
||||||
entityplayer1.posX - this.xCoord + xf,
|
teleportEntitiesToOtherWorld(
|
||||||
entityplayer1.posY - this.yCoord + yf,
|
localEntities,
|
||||||
entityplayer1.posZ - this.zCoord + zf);
|
worldObj,
|
||||||
}
|
this.xCoord,
|
||||||
|
this.yCoord,
|
||||||
|
this.zCoord,
|
||||||
|
targetWorld,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z);
|
||||||
|
teleportEntitiesToOtherWorld(
|
||||||
|
targetEntities,
|
||||||
|
targetWorld,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
worldObj,
|
||||||
|
this.xCoord,
|
||||||
|
this.yCoord,
|
||||||
|
this.zCoord);
|
||||||
|
|
||||||
while (iterator2.hasNext()) {
|
}
|
||||||
entityplayer2 = (EntityLivingBase) iterator2.next();
|
}
|
||||||
entityplayer2.worldObj = worldF;
|
|
||||||
entityplayer2.setPositionAndUpdate(
|
|
||||||
entityplayer2.posX + this.xCoord - xf,
|
|
||||||
entityplayer2.posY + this.yCoord - yf,
|
|
||||||
entityplayer2.posZ + this.zCoord - zf);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
iterator1 = list1.iterator();
|
|
||||||
iterator2 = list2.iterator();
|
|
||||||
|
|
||||||
while (iterator1.hasNext()) {
|
private List<EntityLivingBase> getEntitiesInArea(World world, int x, int y, int z, int size) {
|
||||||
entityplayer1 = (EntityLivingBase) iterator1.next();
|
double half = (size * 2 - 1) / 2.0;
|
||||||
SpellHelper.teleportEntityToDim(
|
|
||||||
worldObj,
|
|
||||||
worldF.provider.dimensionId,
|
|
||||||
entityplayer1.posX - this.xCoord + xf,
|
|
||||||
entityplayer1.posY - this.yCoord + yf,
|
|
||||||
entityplayer1.posZ - this.zCoord + zf,
|
|
||||||
entityplayer1);
|
|
||||||
// entityplayer1.worldObj = worldF;
|
|
||||||
// entityplayer1.setPositionAndUpdate(entityplayer1.posX
|
|
||||||
// - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ -
|
|
||||||
// this.zCoord + zf);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (iterator2.hasNext()) {
|
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(
|
||||||
entityplayer2 = (EntityLivingBase) iterator2.next();
|
x + 0.5 - half,
|
||||||
SpellHelper.teleportEntityToDim(
|
y + 1,
|
||||||
worldF,
|
z + 0.5 - half,
|
||||||
worldObj.provider.dimensionId,
|
x + 0.5 + half,
|
||||||
entityplayer2.posX + this.xCoord - xf,
|
y + 1 + (size * 2 - 1),
|
||||||
entityplayer2.posY + this.yCoord - yf,
|
z + 0.5 + half);
|
||||||
entityplayer2.posZ + this.zCoord - zf,
|
|
||||||
entityplayer2);
|
return world.getEntitiesWithinAABB(EntityLivingBase.class, box);
|
||||||
// entityplayer2.worldObj = worldF;
|
}
|
||||||
// entityplayer2.setPositionAndUpdate(entityplayer2.posX
|
|
||||||
// + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ +
|
private int moveBlocks(int focusLevel, World targetWorld, int x, int y, int z) {
|
||||||
// this.zCoord - zf);
|
int transportCount = 0;
|
||||||
}
|
int range = focusLevel - 1;
|
||||||
}
|
|
||||||
|
for (int k = 0; k <= (focusLevel * 2 - 2); k++) {
|
||||||
|
for (int i = -range; i <= range; i++) {
|
||||||
|
for (int j = -range; j <= range; j++) {
|
||||||
|
if (BlockTeleposer.swapBlocks(
|
||||||
|
this,
|
||||||
|
worldObj,
|
||||||
|
targetWorld,
|
||||||
|
xCoord + i,
|
||||||
|
yCoord + 1 + k,
|
||||||
|
zCoord + j,
|
||||||
|
x + i,
|
||||||
|
y + 1 + k,
|
||||||
|
z + j)) {
|
||||||
|
transportCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return transportCount;
|
||||||
previousInput = currentInput;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActive() {
|
private void teleportEntitiesSameWorld(List<EntityLivingBase> list, int sourceX, int sourceY, int sourceZ,
|
||||||
isActive = false;
|
int destX, int destY, int destZ) {
|
||||||
|
String sound = "mob.endermen.portal";
|
||||||
|
for (EntityLivingBase e : list) {
|
||||||
|
e.setPositionAndUpdate(e.posX - sourceX + destX, e.posY - sourceY + destY, e.posZ - sourceZ + destZ);
|
||||||
|
e.worldObj.playSoundEffect(e.posX, e.posY, e.posZ, sound, 1.0F, 1.0F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
private void teleportEntitiesToOtherWorld(List<EntityLivingBase> list, World sourceWorld, int sourceX, int sourceY,
|
||||||
return isActive;
|
int sourceZ, World destWorld, int destX, int destY, int destZ) {
|
||||||
|
for (EntityLivingBase e : list) {
|
||||||
|
SpellHelper.teleportEntityToDim(
|
||||||
|
sourceWorld,
|
||||||
|
destWorld.provider.dimensionId,
|
||||||
|
e.posX - sourceX + destX,
|
||||||
|
e.posY - sourceY + destY,
|
||||||
|
e.posZ - sourceZ + destZ,
|
||||||
|
e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -247,11 +206,8 @@ public class TETeleposer extends TEInventory implements IBloodMagicWailaProvider
|
|||||||
|
|
||||||
if (intData.length == 3) {
|
if (intData.length == 3) {
|
||||||
for (int i = 0; i < 1; i++) {
|
for (int i = 0; i < 1; i++) {
|
||||||
if (intData[i * 3 + 2] != 0) {
|
if (intData[2] != 0) {
|
||||||
ItemStack is = new ItemStack(
|
ItemStack is = new ItemStack(Item.getItemById(intData[i * 3]), intData[2], intData[1]);
|
||||||
Item.getItemById(intData[i * 3]),
|
|
||||||
intData[i * 3 + 2],
|
|
||||||
intData[i * 3 + 1]);
|
|
||||||
inv[i] = is;
|
inv[i] = is;
|
||||||
} else {
|
} else {
|
||||||
inv[i] = null;
|
inv[i] = null;
|
||||||
@@ -261,18 +217,17 @@ public class TETeleposer extends TEInventory implements IBloodMagicWailaProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int[] buildIntDataList() {
|
public int[] buildIntDataList() {
|
||||||
int[] sortList = new int[3]; // 1 * 3
|
int[] sortList = new int[3];
|
||||||
int pos = 0;
|
|
||||||
|
|
||||||
for (ItemStack is : inv) {
|
for (ItemStack is : inv) {
|
||||||
if (is != null) {
|
if (is != null) {
|
||||||
sortList[pos++] = Item.getIdFromItem(is.getItem());
|
sortList[0] = Item.getIdFromItem(is.getItem());
|
||||||
sortList[pos++] = is.getItemDamage();
|
sortList[1] = is.getItemDamage();
|
||||||
sortList[pos++] = is.stackSize;
|
sortList[2] = is.stackSize;
|
||||||
} else {
|
} else {
|
||||||
sortList[pos++] = 0;
|
for (int i = 0; i < 3; i++) {
|
||||||
sortList[pos++] = 0;
|
sortList[i] = 0;
|
||||||
sortList[pos++] = 0;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,12 +244,20 @@ public class TETeleposer extends TEInventory implements IBloodMagicWailaProvider
|
|||||||
IWailaConfigHandler config) {
|
IWailaConfigHandler config) {
|
||||||
if (!config.getConfig(BloodMagicWailaPlugin.WAILA_CONFIG_TELEPOSER)) return;
|
if (!config.getConfig(BloodMagicWailaPlugin.WAILA_CONFIG_TELEPOSER)) return;
|
||||||
final ItemStack contained = getStackInSlot(0);
|
final ItemStack contained = getStackInSlot(0);
|
||||||
if (contained != null) {
|
if (contained.getItem() instanceof TelepositionFocus focus) {
|
||||||
currenttip.add(contained.getDisplayName());
|
currenttip.add(contained.getDisplayName());
|
||||||
|
|
||||||
|
NBTTagCompound itemTag = IBindable.getTag(contained);
|
||||||
|
currenttip.add(
|
||||||
|
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
|
||||||
|
+ itemTag.getInteger("xCoord")
|
||||||
|
+ ", "
|
||||||
|
+ itemTag.getInteger("yCoord")
|
||||||
|
+ ", "
|
||||||
|
+ itemTag.getInteger("zCoord"));
|
||||||
|
currenttip.add(
|
||||||
|
StatCollector.translateToLocal("tooltip.alchemy.dimension") + " "
|
||||||
|
+ focus.getDimensionID(contained));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getWailaNBTData(final EntityPlayerMP player, final TileEntity tile, final NBTTagCompound tag,
|
|
||||||
final World world, int x, int y, int z) {}
|
|
||||||
}
|
}
|
||||||
@@ -579,6 +579,7 @@ message.tanksegmenter.nowhas=Tank now has
|
|||||||
message.tanksegmenter.setto=Tank Segmenter now set to:
|
message.tanksegmenter.setto=Tank Segmenter now set to:
|
||||||
message.tanksegmenter.tankssetto=tank(s) set to:
|
message.tanksegmenter.tankssetto=tank(s) set to:
|
||||||
message.routerfocus.limit=Focus' Item Limit set to:
|
message.routerfocus.limit=Focus' Item Limit set to:
|
||||||
|
message.warn.spiritWorld=Teleporting to Witchery's Spirit World causes problems and is temporarily disabled.
|
||||||
|
|
||||||
#Achievements
|
#Achievements
|
||||||
achievement.alchemicalwizardry:firstPrick=Your First Prick!
|
achievement.alchemicalwizardry:firstPrick=Your First Prick!
|
||||||
|
|||||||
Reference in new issue
Block a user