use of com.teamwizardry.wizardry.common.network.PacketWorktableUpdate in project Wizardry by TeamWizardry.
the class WorktableGui method sync.
public void sync() {
if (!Minecraft.getMinecraft().world.isBlockLoaded(worktablePos))
return;
IBlockState state = Minecraft.getMinecraft().world.getBlockState(worktablePos);
if (state.getBlock() != ModBlocks.MAGICIANS_WORKTABLE)
return;
TileEntity table = Minecraft.getMinecraft().world.getTileEntity(worktablePos);
if (!(table instanceof TileMagiciansWorktable))
return;
HashMap<SpellRing, UUID> convertComponents = new HashMap<>();
for (Map.Entry<GuiComponent, UUID> entrySet : paperComponents.entrySet()) {
Module module1 = getModule(entrySet.getKey());
if (module1 == null)
continue;
SpellRing ring = new SpellRing(module1);
ring.getInformationTag().setDouble("worktable_x", entrySet.getKey().getPos().getX());
ring.getInformationTag().setDouble("worktable_y", entrySet.getKey().getPos().getY());
convertComponents.put(ring, entrySet.getValue());
}
((TileMagiciansWorktable) table).componentLinks = componentLinks;
((TileMagiciansWorktable) table).paperComponents = convertComponents;
PacketHandler.NETWORK.sendToServer(new PacketWorktableUpdate(Minecraft.getMinecraft().world.provider.getDimension(), worktablePos, convertComponents, componentLinks));
}
Aggregations