mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-26 23:02:59 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77c4dee42f | ||
|
|
06e0821e67 | ||
|
|
a950c8f23b |
No files matched your search
@@ -3,9 +3,9 @@ name: Build and test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, main ]
|
branches: [ master, main, release/** ]
|
||||||
push:
|
push:
|
||||||
branches: [ master, main ]
|
branches: [ master, main, release/** ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
|
|||||||
@@ -91,16 +91,11 @@ public class ItemCertusQuartzTank extends BaseItemBlockContainer implements IFlu
|
|||||||
|
|
||||||
if (!container.stackTagCompound.hasKey("tileEntity")
|
if (!container.stackTagCompound.hasKey("tileEntity")
|
||||||
|| container.stackTagCompound.getCompoundTag("tileEntity").hasKey("Empty")) {
|
|| container.stackTagCompound.getCompoundTag("tileEntity").hasKey("Empty")) {
|
||||||
NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound());
|
int finalAmount = Math.min(resource.amount, this.capacity);
|
||||||
|
NBTTagCompound fluidTag = new FluidStack(resource.getFluid(), finalAmount, resource.tag)
|
||||||
if (this.capacity < resource.amount) {
|
.writeToNBT(new NBTTagCompound());
|
||||||
fluidTag.setInteger("Amount", this.capacity);
|
|
||||||
container.stackTagCompound.setTag("tileEntity", fluidTag);
|
container.stackTagCompound.setTag("tileEntity", fluidTag);
|
||||||
return this.capacity;
|
return finalAmount;
|
||||||
}
|
|
||||||
|
|
||||||
container.stackTagCompound.setTag("tileEntity", fluidTag);
|
|
||||||
return resource.amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("tileEntity");
|
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("tileEntity");
|
||||||
|
|||||||
@@ -59,8 +59,9 @@ public class WirelessMagnet {
|
|||||||
// This method uses the same algorithm as the magnet from draconic evolution
|
// This method uses the same algorithm as the magnet from draconic evolution
|
||||||
// if changes are ever made, they should be made on both
|
// if changes are ever made, they should be made on both
|
||||||
public static void doMagnet(ItemStack wirelessTerm, EntityPlayer player) {
|
public static void doMagnet(ItemStack wirelessTerm, EntityPlayer player) {
|
||||||
if (player.ticksExisted % 5 != 0 || player.isSneaking() || !isConfigured(wirelessTerm)) return;
|
final World world = player.worldObj;
|
||||||
World world = player.worldObj;
|
if (world.isRemote || player.ticksExisted % 5 != 0 || player.isSneaking() || !isConfigured(wirelessTerm))
|
||||||
|
return;
|
||||||
final List<EntityItem> items = getEntitiesInRange(
|
final List<EntityItem> items = getEntitiesInRange(
|
||||||
EntityItem.class,
|
EntityItem.class,
|
||||||
world,
|
world,
|
||||||
@@ -70,9 +71,7 @@ public class WirelessMagnet {
|
|||||||
magnetRange);
|
magnetRange);
|
||||||
final boolean skipPlayerCheck = world.playerEntities.size() < 2;
|
final boolean skipPlayerCheck = world.playerEntities.size() < 2;
|
||||||
boolean playSound = false;
|
boolean playSound = false;
|
||||||
// account for the server/client desync
|
double playerEyesPos = player.posY + player.getEyeHeight();
|
||||||
double playerEyesPos = player.posY
|
|
||||||
+ (world.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight());
|
|
||||||
|
|
||||||
for (EntityItem itemToGet : items) {
|
for (EntityItem itemToGet : items) {
|
||||||
if (itemToGet.getEntityItem() == null || itemToGet instanceof EntityFloatingItem) {
|
if (itemToGet.getEntityItem() == null || itemToGet instanceof EntityFloatingItem) {
|
||||||
@@ -95,6 +94,10 @@ public class WirelessMagnet {
|
|||||||
player.posX - 0.2 + (world.rand.nextDouble() * 0.4),
|
player.posX - 0.2 + (world.rand.nextDouble() * 0.4),
|
||||||
playerEyesPos - 0.62,
|
playerEyesPos - 0.62,
|
||||||
player.posZ - 0.2 + (world.rand.nextDouble() * 0.4));
|
player.posZ - 0.2 + (world.rand.nextDouble() * 0.4));
|
||||||
|
// EntityTracker only syncs item positions every 20 ticks and skips small velocity changes,
|
||||||
|
// so force both; otherwise the client keeps simulating the item with its old motion.
|
||||||
|
itemToGet.isAirBorne = true; // force position update
|
||||||
|
itemToGet.velocityChanged = true; // force velocity update
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playSound) {
|
if (playSound) {
|
||||||
@@ -105,7 +108,6 @@ public class WirelessMagnet {
|
|||||||
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F));
|
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!world.isRemote) {
|
|
||||||
// xp
|
// xp
|
||||||
final List<EntityXPOrb> xpOrbs = getEntitiesInRange(
|
final List<EntityXPOrb> xpOrbs = getEntitiesInRange(
|
||||||
EntityXPOrb.class,
|
EntityXPOrb.class,
|
||||||
@@ -134,7 +136,6 @@ public class WirelessMagnet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static Mode getMode(ItemStack is) {
|
public static Mode getMode(ItemStack is) {
|
||||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||||
|
|||||||
Reference in new issue
Block a user