Remove a bunch of redundant markdirty and updateComparator calls, the former causing network spam and the latter just being unnecessary

This commit is contained in:
Vincent Lee committed 2020-06-13 10:38:26 -05:00
1 parent 267e4da7cd
commit 8e499b710d
11 files changed
+4 -22

No files matched your search

@@ -122,7 +122,6 @@ public class BlockAltar extends BlockMod {
}
tile.setFluid(Fluids.EMPTY);
world.updateComparatorOutputLevel(pos, this);
world.getChunkProvider().getLightManager().checkBlock(pos);
return ActionResultType.SUCCESS;
@@ -135,7 +134,6 @@ public class BlockAltar extends BlockMod {
}
tile.setFluid(Fluids.WATER);
world.updateComparatorOutputLevel(pos, this);
world.getChunkProvider().getLightManager().checkBlock(pos);
}
@@ -147,7 +145,6 @@ public class BlockAltar extends BlockMod {
}
tile.setFluid(Fluids.LAVA);
world.updateComparatorOutputLevel(pos, this);
world.getChunkProvider().getLightManager().checkBlock(pos);
}
@@ -167,7 +164,6 @@ public class BlockAltar extends BlockMod {
if (altar.getFluid() == Fluids.EMPTY) {
altar.setFluid(Fluids.WATER);
}
world.updateComparatorOutputLevel(pos, this);
}
}
}
@@ -86,13 +86,11 @@ public class BlockHourglass extends BlockModWaterloggable implements IManaTrigge
if (hgStack.isEmpty() && TileHourglass.getStackItemTime(stack) > 0) {
hourglass.getItemHandler().setStackInSlot(0, stack.copy());
hourglass.markDirty();
stack.setCount(0);
return ActionResultType.SUCCESS;
} else if (!hgStack.isEmpty()) {
ItemHandlerHelper.giveItemToPlayer(player, hgStack);
hourglass.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
hourglass.markDirty();
return ActionResultType.SUCCESS;
}
@@ -73,13 +73,10 @@ public class BlockSparkChanger extends BlockModWaterloggable {
ItemStack cstack = changer.getItemHandler().getStackInSlot(0);
if (!cstack.isEmpty()) {
changer.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
world.updateComparatorOutputLevel(pos, this);
changer.markDirty();
ItemHandlerHelper.giveItemToPlayer(player, cstack);
return ActionResultType.SUCCESS;
} else if (!pstack.isEmpty() && pstack.getItem() instanceof ItemSparkUpgrade) {
changer.getItemHandler().setStackInSlot(0, pstack.split(1));
world.updateComparatorOutputLevel(pos, this);
changer.markDirty();
return ActionResultType.SUCCESS;
@@ -99,7 +99,6 @@ public class BlockEnchanter extends BlockMod implements IWandable, IWandHUD {
world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant));
}
world.updateComparatorOutputLevel(pos, state.getBlock());
super.onReplaced(state, world, pos, newState, isMoving);
}
}
@@ -151,11 +151,9 @@ public class BlockSpreader extends BlockModWaterloggable implements IWandable, I
}
spreader.getItemHandler().setStackInSlot(0, heldItem.copy());
spreader.markDirty();
} else if (!lens.isEmpty() && !wool) {
ItemHandlerHelper.giveItemToPlayer(player, lens);
spreader.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
spreader.markDirty();
}
if (wool && spreader.paddingColor == null) {
@@ -124,13 +124,11 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
if (!drainWater.isEmpty() && drainWater.getFluid() == Fluids.WATER && drainWater.getAmount() == FluidAttributes.BUCKET_VOLUME) {
setFluid(Fluids.WATER);
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
fluidHandler.drain(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
item.setItem(fluidHandler.getContainer());
return true;
} else if (!drainLava.isEmpty() && drainLava.getFluid() == Fluids.LAVA && drainLava.getAmount() == FluidAttributes.BUCKET_VOLUME) {
setFluid(Fluids.LAVA);
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
fluidHandler.drain(new FluidStack(Fluids.LAVA, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
item.setItem(fluidHandler.getContainer());
return true;
@@ -163,7 +161,6 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
world.addEntity(outputItem);
setFluid(Fluids.EMPTY);
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
world.addBlockEvent(getPos(), getBlockState().getBlock(), CRAFT_EFFECT_EVENT, 0);
});
@@ -363,6 +360,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
Preconditions.checkArgument(fluid == Fluids.WATER || fluid == Fluids.LAVA || fluid == Fluids.EMPTY);
this.fluid = fluid;
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
world.updateComparatorOutputLevel(getPos(), getBlockState().getBlock());
}
@Override
@@ -161,7 +161,6 @@ public class TileCraftCrate extends TileOpenCrate {
}
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
}
markDirty();
}
@Override
@@ -110,7 +110,7 @@ public class TileIncensePlate extends TileSimpleInventory implements ITickableTi
}
if (comparatorOutput != newComparator) {
comparatorOutput = newComparator;
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
}
}
@@ -70,8 +70,6 @@ public class TileSparkChanger extends TileSimpleInventory {
transfers.clear();
}
itemHandler.setStackInSlot(0, sparkStack);
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
markDirty();
}
}
@@ -120,7 +120,6 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
this.mana = Math.max(0, Math.min(getCurrentMana() + mana, manaCap));
if (old != this.mana) {
markDirty();
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
markDispatchable();
}
}