Compare commits

..
Author SHA1 Message Date
UltraProdigy c147af2d1d ci: run build and test on release branches 2026-11-09 02:21:26 -05:00
2 changed files with 39 additions and 35 deletions

No files matched your search

@@ -91,11 +91,16 @@ public class ItemCertusQuartzTank extends BaseItemBlockContainer implements IFlu
if (!container.stackTagCompound.hasKey("tileEntity")
|| container.stackTagCompound.getCompoundTag("tileEntity").hasKey("Empty")) {
int finalAmount = Math.min(resource.amount, this.capacity);
NBTTagCompound fluidTag = new FluidStack(resource.getFluid(), finalAmount, resource.tag)
.writeToNBT(new NBTTagCompound());
NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound());
if (this.capacity < resource.amount) {
fluidTag.setInteger("Amount", this.capacity);
container.stackTagCompound.setTag("tileEntity", fluidTag);
return this.capacity;
}
container.stackTagCompound.setTag("tileEntity", fluidTag);
return finalAmount;
return resource.amount;
}
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("tileEntity");
@@ -59,9 +59,8 @@ public class WirelessMagnet {
// This method uses the same algorithm as the magnet from draconic evolution
// if changes are ever made, they should be made on both
public static void doMagnet(ItemStack wirelessTerm, EntityPlayer player) {
final World world = player.worldObj;
if (world.isRemote || player.ticksExisted % 5 != 0 || player.isSneaking() || !isConfigured(wirelessTerm))
return;
if (player.ticksExisted % 5 != 0 || player.isSneaking() || !isConfigured(wirelessTerm)) return;
World world = player.worldObj;
final List<EntityItem> items = getEntitiesInRange(
EntityItem.class,
world,
@@ -71,7 +70,9 @@ public class WirelessMagnet {
magnetRange);
final boolean skipPlayerCheck = world.playerEntities.size() < 2;
boolean playSound = false;
double playerEyesPos = player.posY + player.getEyeHeight();
// account for the server/client desync
double playerEyesPos = player.posY
+ (world.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight());
for (EntityItem itemToGet : items) {
if (itemToGet.getEntityItem() == null || itemToGet instanceof EntityFloatingItem) {
@@ -94,10 +95,6 @@ public class WirelessMagnet {
player.posX - 0.2 + (world.rand.nextDouble() * 0.4),
playerEyesPos - 0.62,
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) {
@@ -108,31 +105,33 @@ public class WirelessMagnet {
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F));
}
// xp
final List<EntityXPOrb> xpOrbs = getEntitiesInRange(
EntityXPOrb.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
magnetRange);
if (!world.isRemote) {
// xp
final List<EntityXPOrb> xpOrbs = getEntitiesInRange(
EntityXPOrb.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
magnetRange);
for (EntityXPOrb xpToGet : xpOrbs) {
if (xpToGet.field_70532_c == 0 && xpToGet.isEntityAlive()) {
if (!skipPlayerCheck) {
EntityPlayer closestPlayer = world.getClosestPlayerToEntity(xpToGet, magnetRange);
if (closestPlayer == null || closestPlayer != player) continue;
for (EntityXPOrb xpToGet : xpOrbs) {
if (xpToGet.field_70532_c == 0 && xpToGet.isEntityAlive()) {
if (!skipPlayerCheck) {
EntityPlayer closestPlayer = world.getClosestPlayerToEntity(xpToGet, magnetRange);
if (closestPlayer == null || closestPlayer != player) continue;
}
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, xpToGet))) continue;
world.playSoundAtEntity(
player,
"random.orb",
0.1F,
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F));
player.onItemPickup(xpToGet, 1);
player.addExperience(xpToGet.xpValue);
xpToGet.setDead();
}
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, xpToGet))) continue;
world.playSoundAtEntity(
player,
"random.orb",
0.1F,
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F));
player.onItemPickup(xpToGet, 1);
player.addExperience(xpToGet.xpValue);
xpToGet.setDead();
}
}
}