porting of the ports

This commit is contained in:
Boblet 2025-01-23 16:49:42 +01:00
parent 31eeb2ab94
commit 11e96c08c0
4 changed files with 63 additions and 3 deletions

View File

@ -23,7 +23,6 @@ import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.ResourcePackRepository;
import net.minecraft.launchwrapper.Launch;
@NotableComments
public class QMAWLoader implements IResourceManagerReloadListener {

View File

@ -11,6 +11,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider {
@ -25,8 +26,14 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
@Override
public DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord - rot.offsetX * 5, yCoord, zCoord - rot.offsetZ * 5, rot.getOpposite()),
new DirPos(xCoord - rot.offsetX * 5, yCoord + 1, zCoord - rot.offsetZ * 5, rot.getOpposite()),
new DirPos(xCoord - rot.offsetX * 5, yCoord - 1, zCoord - rot.offsetZ * 5, rot.getOpposite()),
new DirPos(xCoord - rot.offsetX * 5 + dir.offsetX, yCoord, zCoord - rot.offsetZ * 5 + dir.offsetZ, rot.getOpposite()),
new DirPos(xCoord - rot.offsetX * 5 - dir.offsetX, yCoord, zCoord - rot.offsetZ * 5 - dir.offsetZ, rot.getOpposite()),
};
}

View File

@ -8,13 +8,20 @@ import com.hbm.util.fauxpointtwelve.DirPos;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProvider {
public int dirLower;
public int dirUpper;
public int dirRedstone;
public int threshold;
public TileEntityPADipole() {
super(2);
@ -44,6 +51,44 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
super.updateEntity();
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
buf.writeInt(dirLower);
buf.writeInt(dirUpper);
buf.writeInt(dirRedstone);
buf.writeInt(threshold);
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
dirLower = buf.readInt();
dirUpper = buf.readInt();
dirRedstone = buf.readInt();
threshold = buf.readInt();
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
dirLower = nbt.getInteger("dirLower");
dirUpper = nbt.getInteger("dirUpper");
dirRedstone = nbt.getInteger("dirRedstone");
threshold = nbt.getInteger("threshold");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("dirLower", dirLower);
nbt.setInteger("dirUpper", dirUpper);
nbt.setInteger("dirRedstone", dirRedstone);
nbt.setInteger("threshold", threshold);
}
AxisAlignedBB bb = null;

View File

@ -11,6 +11,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityPASource extends TileEntityCooledBase implements IGUIProvider {
@ -25,8 +26,16 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
@Override
public DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2, dir),
new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * 2, dir),
new DirPos(xCoord + dir.offsetX * 2 - rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2 - rot.offsetZ * 2, dir),
new DirPos(xCoord - dir.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord + rot.offsetX * 5, yCoord, zCoord + rot.offsetZ * 5, rot),
};
}