use of com.teamwizardry.wizardry.common.tile.TileMagiciansWorktable in project Wizardry by TeamWizardry.
the class PacketWorktableUpdate method handle.
@Override
public void handle(@Nonnull MessageContext messageContext) {
World world = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(worldID);
if (!world.isBlockLoaded(pos))
return;
IBlockState state = world.getBlockState(pos);
if (state.getBlock() != ModBlocks.MAGICIANS_WORKTABLE)
return;
TileEntity table = world.getTileEntity(pos);
if (table == null)
return;
if (!(table instanceof TileMagiciansWorktable))
return;
((TileMagiciansWorktable) table).componentLinks = links;
((TileMagiciansWorktable) table).paperComponents = components;
table.markDirty();
}
use of com.teamwizardry.wizardry.common.tile.TileMagiciansWorktable 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