mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Merge branch 'mc1.15/dev' of https://github.com/Creators-of-Create/Create into mc1.15/dev
This commit is contained in:
commit
af9ed3e44b
6 changed files with 74 additions and 155 deletions
|
@ -1,19 +1,7 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.base.BackHalfShaftInstance;
|
import com.simibubi.create.content.contraptions.base.*;
|
||||||
import com.simibubi.create.content.contraptions.base.HalfShaftInstance;
|
import com.simibubi.create.content.contraptions.components.actors.*;
|
||||||
import com.simibubi.create.content.contraptions.base.HorizontalHalfShaftInstance;
|
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.base.ShaftlessCogInstance;
|
|
||||||
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.DrillInstance;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.DrillRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.DrillTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.HarvesterRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.PortableFluidInterfaceTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.components.clock.CuckooClockRenderer;
|
import com.simibubi.create.content.contraptions.components.clock.CuckooClockRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.clock.CuckooClockTileEntity;
|
import com.simibubi.create.content.contraptions.components.clock.CuckooClockTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterInstance;
|
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterInstance;
|
||||||
|
@ -57,9 +45,9 @@ import com.simibubi.create.content.contraptions.components.structureMovement.cha
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerTileEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerTileEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageTileEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageInstance;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonTileEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonTileEntity;
|
||||||
|
@ -70,18 +58,8 @@ import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheel
|
||||||
import com.simibubi.create.content.contraptions.fluids.PumpCogInstance;
|
import com.simibubi.create.content.contraptions.fluids.PumpCogInstance;
|
||||||
import com.simibubi.create.content.contraptions.fluids.PumpRenderer;
|
import com.simibubi.create.content.contraptions.fluids.PumpRenderer;
|
||||||
import com.simibubi.create.content.contraptions.fluids.PumpTileEntity;
|
import com.simibubi.create.content.contraptions.fluids.PumpTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.fluids.actors.HosePulleyRenderer;
|
import com.simibubi.create.content.contraptions.fluids.actors.*;
|
||||||
import com.simibubi.create.content.contraptions.fluids.actors.HosePulleyTileEntity;
|
import com.simibubi.create.content.contraptions.fluids.pipes.*;
|
||||||
import com.simibubi.create.content.contraptions.fluids.actors.ItemDrainRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.actors.ItemDrainTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.actors.SpoutRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.actors.SpoutTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.pipes.FluidValveRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.pipes.FluidValveTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.pipes.SmartFluidPipeTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.pipes.StraightPipeTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.pipes.TransparentStraightPipeRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity;
|
import com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankRenderer;
|
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankRenderer;
|
||||||
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity;
|
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity;
|
||||||
|
@ -97,13 +75,7 @@ import com.simibubi.create.content.contraptions.relays.belt.BeltInstance;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltRenderer;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltRenderer;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.SimpleKineticTileEntity;
|
import com.simibubi.create.content.contraptions.relays.elementary.SimpleKineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.AdjustablePulleyTileEntity;
|
import com.simibubi.create.content.contraptions.relays.encased.*;
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.ClutchTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.EncasedShaftRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.EncasedShaftTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.SplitShaftInstance;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.SplitShaftRenderer;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.gauge.GaugeRenderer;
|
import com.simibubi.create.content.contraptions.relays.gauge.GaugeRenderer;
|
||||||
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeTileEntity;
|
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity;
|
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity;
|
||||||
|
@ -132,19 +104,15 @@ import com.simibubi.create.content.logistics.block.inventories.CreativeCrateTile
|
||||||
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmInstance;
|
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmInstance;
|
||||||
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmRenderer;
|
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmRenderer;
|
||||||
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmTileEntity;
|
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmTileEntity;
|
||||||
import com.simibubi.create.content.logistics.block.redstone.AnalogLeverRenderer;
|
import com.simibubi.create.content.logistics.block.redstone.*;
|
||||||
import com.simibubi.create.content.logistics.block.redstone.AnalogLeverTileEntity;
|
|
||||||
import com.simibubi.create.content.logistics.block.redstone.ContentObserverTileEntity;
|
|
||||||
import com.simibubi.create.content.logistics.block.redstone.NixieTubeRenderer;
|
|
||||||
import com.simibubi.create.content.logistics.block.redstone.NixieTubeTileEntity;
|
|
||||||
import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkTileEntity;
|
|
||||||
import com.simibubi.create.content.logistics.block.redstone.StockpileSwitchTileEntity;
|
|
||||||
import com.simibubi.create.content.schematics.block.SchematicTableTileEntity;
|
import com.simibubi.create.content.schematics.block.SchematicTableTileEntity;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicannonInstance;
|
import com.simibubi.create.content.schematics.block.SchematicannonInstance;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicannonRenderer;
|
import com.simibubi.create.content.schematics.block.SchematicannonRenderer;
|
||||||
import com.simibubi.create.content.schematics.block.SchematicannonTileEntity;
|
import com.simibubi.create.content.schematics.block.SchematicannonTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
||||||
import com.tterrag.registrate.util.entry.TileEntityEntry;
|
import com.tterrag.registrate.util.entry.TileEntityEntry;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class AllTileEntities {
|
public class AllTileEntities {
|
||||||
|
|
||||||
|
@ -364,7 +332,7 @@ public class AllTileEntities {
|
||||||
.tileEntity("mechanical_arm", ArmTileEntity::new)
|
.tileEntity("mechanical_arm", ArmTileEntity::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_ARM)
|
.validBlocks(AllBlocks.MECHANICAL_ARM)
|
||||||
.renderer(() -> ArmRenderer::new)
|
.renderer(() -> ArmRenderer::new)
|
||||||
.onRegister(ArmInstance::register)
|
.onRegister((type) -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ArmInstance.register(type)))//ArmInstance line 142 -> Minecraft.getInstance().world causes ClientWorld to get loaded on the server
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<MechanicalPistonTileEntity> MECHANICAL_PISTON = Create.registrate()
|
public static final TileEntityEntry<MechanicalPistonTileEntity> MECHANICAL_PISTON = Create.registrate()
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
package com.simibubi.create.foundation.command;
|
package com.simibubi.create.foundation.command;
|
||||||
|
|
||||||
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.goggles.GoggleConfigScreen;
|
import com.simibubi.create.content.contraptions.goggles.GoggleConfigScreen;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||||
|
import com.simibubi.create.foundation.ponder.PonderRegistry;
|
||||||
|
import com.simibubi.create.foundation.ponder.PonderUI;
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderIndexScreen;
|
import com.simibubi.create.foundation.ponder.content.PonderIndexScreen;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
@ -66,7 +70,7 @@ public class ConfigureConfigPacket extends SimplePacketBase {
|
||||||
fixLighting(() -> Actions::experimentalLighting),
|
fixLighting(() -> Actions::experimentalLighting),
|
||||||
overlayReset(() -> Actions::overlayReset),
|
overlayReset(() -> Actions::overlayReset),
|
||||||
experimentalRendering(() -> Actions::experimentalRendering),
|
experimentalRendering(() -> Actions::experimentalRendering),
|
||||||
ponderIndex(() -> Actions::ponderIndex),
|
openPonder(() -> Actions::openPonder),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -133,8 +137,20 @@ public class ConfigureConfigPacket extends SimplePacketBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private static void ponderIndex(String value) {
|
private static void openPonder(String value) {
|
||||||
|
if (value.equals("index")) {
|
||||||
ScreenOpener.transitionTo(new PonderIndexScreen());
|
ScreenOpener.transitionTo(new PonderIndexScreen());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourceLocation id = new ResourceLocation(value);
|
||||||
|
if (!PonderRegistry.all.containsKey(id)) {
|
||||||
|
Create.logger.error("Could not find ponder scenes for item: " + id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScreenOpener.transitionTo(PonderUI.of(id));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ITextComponent boolToText(boolean b) {
|
private static ITextComponent boolToText(boolean b) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.simibubi.create.foundation.command;
|
package com.simibubi.create.foundation.command;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||||
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.networking.PonderPacket;
|
|
||||||
import com.simibubi.create.foundation.ponder.PonderRegistry;
|
import com.simibubi.create.foundation.ponder.PonderRegistry;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.command.Commands;
|
import net.minecraft.command.Commands;
|
||||||
|
@ -20,34 +20,36 @@ import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public class PonderCommand {
|
public class PonderCommand {
|
||||||
public static final SuggestionProvider<CommandSource> ALL_PONDERS = SuggestionProviders.register(new ResourceLocation("all_ponders"), (iSuggestionProviderCommandContext, builder) -> ISuggestionProvider.func_212476_a(PonderRegistry.all.keySet().stream(), builder));
|
public static final SuggestionProvider<CommandSource> ITEM_PONDERS = SuggestionProviders.register(new ResourceLocation("all_ponders"), (iSuggestionProviderCommandContext, builder) -> ISuggestionProvider.func_212476_a(PonderRegistry.all.keySet().stream(), builder));
|
||||||
|
|
||||||
static ArgumentBuilder<CommandSource, ?> register() {
|
static ArgumentBuilder<CommandSource, ?> register() {
|
||||||
return Commands.literal("ponder")
|
return Commands.literal("ponder")
|
||||||
.requires(cs -> cs.hasPermissionLevel(0))
|
.requires(cs -> cs.hasPermissionLevel(0))
|
||||||
.executes(ctx -> {
|
.executes(ctx -> openScene("index", ctx.getSource().asPlayer()))
|
||||||
ServerPlayerEntity player = ctx.getSource().asPlayer();
|
.then(Commands.argument("scene", ResourceLocationArgument.resourceLocation())
|
||||||
|
.suggests(ITEM_PONDERS)
|
||||||
AllPackets.channel.send(
|
.executes(ctx -> openScene(ResourceLocationArgument.getResourceLocation(ctx, "scene").toString(), ctx.getSource().asPlayer()))
|
||||||
PacketDistributor.PLAYER.with(() -> player),
|
|
||||||
new ConfigureConfigPacket(ConfigureConfigPacket.Actions.ponderIndex.name(), ""));
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
})
|
|
||||||
.then(Commands.argument("scene", ResourceLocationArgument.resourceLocation()).suggests(ALL_PONDERS)
|
|
||||||
.executes(context -> openScene(ResourceLocationArgument.getResourceLocation(context, "scene"), ImmutableList.of(context.getSource().asPlayer())))
|
|
||||||
.then(Commands.argument("targets", EntityArgument.players())
|
.then(Commands.argument("targets", EntityArgument.players())
|
||||||
.requires(cs -> cs.hasPermissionLevel(2))
|
.requires(cs -> cs.hasPermissionLevel(2))
|
||||||
.executes(context -> openScene(ResourceLocationArgument.getResourceLocation(context, "scene"), EntityArgument.getPlayers(context, "targets")))));
|
.executes(ctx -> openScene(ResourceLocationArgument.getResourceLocation(ctx, "scene").toString(), EntityArgument.getPlayers(ctx, "targets")))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int openScene(ResourceLocation scene, Collection<? extends ServerPlayerEntity> players) {
|
private static int openScene(String sceneId, ServerPlayerEntity player) {
|
||||||
|
return openScene(sceneId, ImmutableList.of(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int openScene(String sceneId, Collection<? extends ServerPlayerEntity> players) {
|
||||||
for (ServerPlayerEntity player : players) {
|
for (ServerPlayerEntity player : players) {
|
||||||
if (player instanceof FakePlayer)
|
if (player instanceof FakePlayer)
|
||||||
continue;
|
continue;
|
||||||
AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), new PonderPacket(scene));
|
|
||||||
|
AllPackets.channel.send(
|
||||||
|
PacketDistributor.PLAYER.with(() -> player),
|
||||||
|
new ConfigureConfigPacket(ConfigureConfigPacket.Actions.openPonder.name(), sceneId));
|
||||||
}
|
}
|
||||||
return 1;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
package com.simibubi.create.foundation.networking;
|
package com.simibubi.create.foundation.networking;
|
||||||
|
|
||||||
import static net.minecraftforge.fml.network.NetworkDirection.PLAY_TO_CLIENT;
|
|
||||||
import static net.minecraftforge.fml.network.NetworkDirection.PLAY_TO_SERVER;
|
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionDisassemblyPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionDisassemblyPacket;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionStallPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionStallPacket;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraptionUpdatePacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraptionUpdatePacket;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueEffectPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueEffectPacket;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ClientMotionPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.sync.*;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionFluidPacket;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionInteractionPacket;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionSeatMappingPacket;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.sync.LimbSwingUpdatePacket;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.CouplingCreationPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.train.CouplingCreationPacket;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartControllerUpdatePacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartControllerUpdatePacket;
|
||||||
import com.simibubi.create.content.contraptions.fluids.actors.FluidSplashPacket;
|
import com.simibubi.create.content.contraptions.fluids.actors.FluidSplashPacket;
|
||||||
|
@ -30,17 +19,12 @@ import com.simibubi.create.content.logistics.packet.ConfigureFlexcratePacket;
|
||||||
import com.simibubi.create.content.logistics.packet.ConfigureStockswitchPacket;
|
import com.simibubi.create.content.logistics.packet.ConfigureStockswitchPacket;
|
||||||
import com.simibubi.create.content.logistics.packet.FunnelFlapPacket;
|
import com.simibubi.create.content.logistics.packet.FunnelFlapPacket;
|
||||||
import com.simibubi.create.content.logistics.packet.TunnelFlapPacket;
|
import com.simibubi.create.content.logistics.packet.TunnelFlapPacket;
|
||||||
import com.simibubi.create.content.schematics.packet.ConfigureSchematicannonPacket;
|
import com.simibubi.create.content.schematics.packet.*;
|
||||||
import com.simibubi.create.content.schematics.packet.InstantSchematicPacket;
|
|
||||||
import com.simibubi.create.content.schematics.packet.SchematicPlacePacket;
|
|
||||||
import com.simibubi.create.content.schematics.packet.SchematicSyncPacket;
|
|
||||||
import com.simibubi.create.content.schematics.packet.SchematicUploadPacket;
|
|
||||||
import com.simibubi.create.foundation.command.ConfigureConfigPacket;
|
import com.simibubi.create.foundation.command.ConfigureConfigPacket;
|
||||||
import com.simibubi.create.foundation.command.HighlightPacket;
|
import com.simibubi.create.foundation.command.HighlightPacket;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringCountUpdatePacket;
|
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringCountUpdatePacket;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueUpdatePacket;
|
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueUpdatePacket;
|
||||||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||||
|
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -52,6 +36,13 @@ import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
import net.minecraftforge.fml.network.PacketDistributor.TargetPoint;
|
import net.minecraftforge.fml.network.PacketDistributor.TargetPoint;
|
||||||
import net.minecraftforge.fml.network.simple.SimpleChannel;
|
import net.minecraftforge.fml.network.simple.SimpleChannel;
|
||||||
|
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import static net.minecraftforge.fml.network.NetworkDirection.PLAY_TO_CLIENT;
|
||||||
|
import static net.minecraftforge.fml.network.NetworkDirection.PLAY_TO_SERVER;
|
||||||
|
|
||||||
public enum AllPackets {
|
public enum AllPackets {
|
||||||
|
|
||||||
// Client to Server
|
// Client to Server
|
||||||
|
@ -91,7 +82,6 @@ public enum AllPackets {
|
||||||
BLOCK_HIGHLIGHT(HighlightPacket.class, HighlightPacket::new, PLAY_TO_CLIENT),
|
BLOCK_HIGHLIGHT(HighlightPacket.class, HighlightPacket::new, PLAY_TO_CLIENT),
|
||||||
TUNNEL_FLAP(TunnelFlapPacket.class, TunnelFlapPacket::new, PLAY_TO_CLIENT),
|
TUNNEL_FLAP(TunnelFlapPacket.class, TunnelFlapPacket::new, PLAY_TO_CLIENT),
|
||||||
FUNNEL_FLAP(FunnelFlapPacket.class, FunnelFlapPacket::new, PLAY_TO_CLIENT),
|
FUNNEL_FLAP(FunnelFlapPacket.class, FunnelFlapPacket::new, PLAY_TO_CLIENT),
|
||||||
OPEN_PONDER(PonderPacket.class, PonderPacket::new, PLAY_TO_CLIENT)
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.simibubi.create.foundation.networking;
|
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
|
||||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
|
||||||
import com.simibubi.create.foundation.ponder.PonderRegistry;
|
|
||||||
import com.simibubi.create.foundation.ponder.PonderUI;
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
|
||||||
import net.minecraft.network.PacketBuffer;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.fml.network.NetworkDirection;
|
|
||||||
import net.minecraftforge.fml.network.NetworkEvent;
|
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
public class PonderPacket extends SimplePacketBase {
|
|
||||||
private final ResourceLocation scene;
|
|
||||||
|
|
||||||
public PonderPacket(ResourceLocation scene) {
|
|
||||||
this.scene = scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PonderPacket(PacketBuffer buffer) {
|
|
||||||
this.scene = buffer.readResourceLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(PacketBuffer buffer) {
|
|
||||||
buffer.writeResourceLocation(scene);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(Supplier<NetworkEvent.Context> context) {
|
|
||||||
NetworkEvent.Context ctx = context.get();
|
|
||||||
if (ctx.getDirection() != NetworkDirection.PLAY_TO_CLIENT)
|
|
||||||
return;
|
|
||||||
if (PonderRegistry.all.containsKey(scene))
|
|
||||||
ScreenOpener.transitionTo(new PonderUI(PonderRegistry.compile(PonderRegistry.all.get(scene))));
|
|
||||||
else
|
|
||||||
Create.logger.error("Could not find ponder scene: " + scene);
|
|
||||||
ctx.setPacketHandled(true);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +1,14 @@
|
||||||
package com.simibubi.create.foundation.ponder;
|
package com.simibubi.create.foundation.ponder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
import com.simibubi.create.foundation.gui.*;
|
||||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
|
||||||
import com.simibubi.create.foundation.gui.AllIcons;
|
|
||||||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
|
||||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
|
||||||
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
|
||||||
import com.simibubi.create.foundation.ponder.PonderScene.SceneTransform;
|
import com.simibubi.create.foundation.ponder.PonderScene.SceneTransform;
|
||||||
import com.simibubi.create.foundation.ponder.content.DebugScenes;
|
import com.simibubi.create.foundation.ponder.content.*;
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderChapter;
|
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderIndex;
|
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderTag;
|
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderTagScreen;
|
|
||||||
import com.simibubi.create.foundation.ponder.ui.PonderButton;
|
import com.simibubi.create.foundation.ponder.ui.PonderButton;
|
||||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.*;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
||||||
import com.simibubi.create.foundation.utility.Pair;
|
|
||||||
import com.simibubi.create.foundation.utility.Pointing;
|
|
||||||
|
|
||||||
import net.minecraft.client.ClipboardHelper;
|
import net.minecraft.client.ClipboardHelper;
|
||||||
import net.minecraft.client.GameSettings;
|
import net.minecraft.client.GameSettings;
|
||||||
import net.minecraft.client.MainWindow;
|
import net.minecraft.client.MainWindow;
|
||||||
|
@ -52,6 +29,13 @@ import net.minecraft.world.gen.feature.template.PlacementSettings;
|
||||||
import net.minecraft.world.gen.feature.template.Template;
|
import net.minecraft.world.gen.feature.template.Template;
|
||||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class PonderUI extends AbstractSimiScreen {
|
public class PonderUI extends AbstractSimiScreen {
|
||||||
|
|
||||||
|
@ -85,6 +69,10 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
private PonderButton left, right, scan, chap, userMode;
|
private PonderButton left, right, scan, chap, userMode;
|
||||||
private PonderProgressBar progressBar;
|
private PonderProgressBar progressBar;
|
||||||
|
|
||||||
|
public static PonderUI of(ResourceLocation id) {
|
||||||
|
return new PonderUI(PonderRegistry.compile(id));
|
||||||
|
}
|
||||||
|
|
||||||
public static PonderUI of(ItemStack item) {
|
public static PonderUI of(ItemStack item) {
|
||||||
return new PonderUI(PonderRegistry.compile(item.getItem()
|
return new PonderUI(PonderRegistry.compile(item.getItem()
|
||||||
.getRegistryName()));
|
.getRegistryName()));
|
||||||
|
@ -103,7 +91,7 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
return ui;
|
return ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PonderUI(List<PonderScene> scenes) {
|
PonderUI(List<PonderScene> scenes) {
|
||||||
ResourceLocation component = scenes.get(0).component;
|
ResourceLocation component = scenes.get(0).component;
|
||||||
if (ForgeRegistries.ITEMS.containsKey(component))
|
if (ForgeRegistries.ITEMS.containsKey(component))
|
||||||
stack = new ItemStack(ForgeRegistries.ITEMS.getValue(component));
|
stack = new ItemStack(ForgeRegistries.ITEMS.getValue(component));
|
||||||
|
|
Loading…
Reference in a new issue