@@ -1 +1 @@ | |||
Subproject commit 9685494d72d91d258c9452b01f450737f54f7c8b | |||
Subproject commit 16096c5c722cd96fa22f535e118678fa5c839ab6 |
@@ -1,11 +1,11 @@ | |||
package com.gildedgames.orbis.client.godmode; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.player.godmode.GodPowerCreative; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
import net.minecraft.util.ResourceLocation; | |||
import net.minecraft.world.World; | |||
@@ -82,7 +82,8 @@ public class GodPowerEntranceClient implements IGodPowerClient | |||
@Override | |||
public Object raytraceObject(PlayerOrbis playerOrbis) | |||
{ | |||
if (playerOrbis.getSelectedSchedule() != null) { | |||
if (playerOrbis.getSelectedSchedule() != null) | |||
{ | |||
return playerOrbis.getSelectedSchedule(); | |||
} | |||
@@ -1,10 +1,10 @@ | |||
package com.gildedgames.orbis.client.godmode; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.player.godmode.GodPowerSpectator; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
import net.minecraft.util.ResourceLocation; | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
import net.minecraft.world.World; | |||
import net.minecraftforge.client.event.MouseEvent; | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_inputs; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.player.godmode.selection_input.ISelectionInput; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import net.minecraft.world.World; | |||
@@ -1,11 +1,11 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_inputs; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.client.renderers.RenderShape; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.player.godmode.selection_input.ISelectionInput; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.lib.world.IWorldObject; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import com.google.common.collect.Lists; | |||
@@ -1,10 +1,10 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_inputs; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.client.renderers.RenderShape; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.player.godmode.selection_input.ISelectionInput; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.lib.world.IWorldObject; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import com.google.common.collect.Lists; | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_types; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import net.minecraft.util.ResourceLocation; | |||
public class SelectionTypeClientCone implements ISelectionTypeClient | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_types; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import net.minecraft.util.ResourceLocation; | |||
public class SelectionTypeClientCuboid implements ISelectionTypeClient | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_types; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import net.minecraft.util.ResourceLocation; | |||
public class SelectionTypeClientCylinder implements ISelectionTypeClient | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_types; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import net.minecraft.util.ResourceLocation; | |||
public class SelectionTypeClientDome implements ISelectionTypeClient | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_types; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import net.minecraft.util.ResourceLocation; | |||
public class SelectionTypeClientLine implements ISelectionTypeClient | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_types; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import net.minecraft.util.ResourceLocation; | |||
public class SelectionTypeClientPyramid implements ISelectionTypeClient | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.godmode.selection_types; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.lib.client.rect.Dim2D; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import net.minecraft.util.ResourceLocation; | |||
public class SelectionTypeClientSphere implements ISelectionTypeClient | |||
@@ -28,7 +28,7 @@ public class GuiLayerButton extends GuiButtonVanilla implements IScheduleLayerLi | |||
private GuiLayerEditor editor; | |||
private boolean selected,previousState; | |||
private boolean selected, previousState; | |||
public GuiLayerButton(GuiLayerEditor editor, Rect rect, INode<IScheduleLayer, LayerLink> scheduleNode) | |||
{ | |||
@@ -52,7 +52,7 @@ public class GuiLayerButton extends GuiButtonVanilla implements IScheduleLayerLi | |||
this.hidden.listenOnPress((ticked) -> | |||
{ | |||
if (selected && !ticked) | |||
if (this.selected && !ticked) | |||
{ | |||
this.hidden.setTicked(true); | |||
return; | |||
@@ -80,14 +80,14 @@ public class GuiLayerButton extends GuiButtonVanilla implements IScheduleLayerLi | |||
{ | |||
if (!flag) | |||
{ | |||
selected = false; | |||
this.hidden.setTicked(previousState); | |||
this.selected = false; | |||
this.hidden.setTicked(this.previousState); | |||
this.hidden.setTickedTexture(TICK_BOX_EYE); | |||
} | |||
else | |||
{ | |||
selected = true; | |||
previousState = this.hidden.isTicked(); | |||
this.selected = true; | |||
this.previousState = this.hidden.isTicked(); | |||
this.hidden.setTicked(true); | |||
this.hidden.setTickedTexture(TICK_BOX_EYE_SELECTED); | |||
} | |||
@@ -4,7 +4,6 @@ import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.network.packets.PacketChangePower; | |||
import com.gildedgames.orbis.common.player.godmode.IGodPower; | |||
import com.gildedgames.orbis.common.player.modules.PlayerPowerModule; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import java.util.Arrays; | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.gui.power_wheel; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.player.godmode.selection_input.ISelectionInput; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
public class GuiChoiceMenuSelectionInputs extends GuiChoiceMenu | |||
{ | |||
@@ -1,8 +1,8 @@ | |||
package com.gildedgames.orbis.client.gui.power_wheel; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.player.godmode.selection_types.ISelectionType; | |||
import com.gildedgames.orbis.lib.client.gui.util.GuiTexture; | |||
public class GuiChoiceMenuSelectionTypes extends GuiChoiceMenu | |||
{ | |||
@@ -13,59 +13,59 @@ import javax.annotation.Nullable; | |||
public class FakeOrbisFloorWorld implements IBlockAccess | |||
{ | |||
private IBlockState state; | |||
private IBlockState state; | |||
public FakeOrbisFloorWorld(IBlockState state) | |||
{ | |||
this.state = state; | |||
} | |||
public FakeOrbisFloorWorld(IBlockState state) | |||
{ | |||
this.state = state; | |||
} | |||
@Nullable | |||
@Override | |||
public TileEntity getTileEntity(BlockPos pos) | |||
{ | |||
return null; | |||
} | |||
@Nullable | |||
@Override | |||
public TileEntity getTileEntity(BlockPos pos) | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public int getCombinedLight(BlockPos pos, int lightValue) | |||
{ | |||
return 0; | |||
} | |||
@Override | |||
public int getCombinedLight(BlockPos pos, int lightValue) | |||
{ | |||
return 0; | |||
} | |||
@Override | |||
public IBlockState getBlockState(BlockPos pos) | |||
{ | |||
return state; | |||
} | |||
@Override | |||
public IBlockState getBlockState(BlockPos pos) | |||
{ | |||
return state; | |||
} | |||
@Override | |||
public boolean isAirBlock(BlockPos pos) | |||
{ | |||
return state.getBlock().isAir(state, this, pos); | |||
} | |||
@Override | |||
public boolean isAirBlock(BlockPos pos) | |||
{ | |||
return state.getBlock().isAir(state, this, pos); | |||
} | |||
@Override | |||
public Biome getBiome(BlockPos pos) | |||
{ | |||
return Biomes.PLAINS; | |||
} | |||
@Override | |||
public Biome getBiome(BlockPos pos) | |||
{ | |||
return Biomes.PLAINS; | |||
} | |||
@Override | |||
public int getStrongPower(BlockPos pos, EnumFacing direction) | |||
{ | |||
return 0; | |||
} | |||
@Override | |||
public int getStrongPower(BlockPos pos, EnumFacing direction) | |||
{ | |||
return 0; | |||
} | |||
@Override | |||
public WorldType getWorldType() | |||
{ | |||
return WorldType.DEFAULT; | |||
} | |||
@Override | |||
public WorldType getWorldType() | |||
{ | |||
return WorldType.DEFAULT; | |||
} | |||
@Override | |||
public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) | |||
{ | |||
return state.isSideSolid(this, pos, side); | |||
} | |||
@Override | |||
public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) | |||
{ | |||
return state.isSideSolid(this, pos, side); | |||
} | |||
} |
@@ -87,7 +87,7 @@ public class AirSelectionRenderer | |||
boolean scheduleHoverPossible = | |||
(power == playerOrbis.powers().getSelectPower() && playerOrbis.powers().isScheduling()) | |||
|| power == playerOrbis.powers().getEntrancePower(); | |||
|| power == playerOrbis.powers().getEntrancePower(); | |||
boolean scheduleHover = scheduleHoverPossible && playerOrbis.getSelectedSchedule() != null; | |||
boolean blueprintHover = power == playerOrbis.powers().getBlueprintPower() | |||
@@ -62,7 +62,8 @@ public class RenderBlueprintEditing | |||
} | |||
} | |||
if (this.blueprint.getData().getEntrance() != null) { | |||
if (this.blueprint.getData().getEntrance() != null) | |||
{ | |||
this.onAddEntrance(this.blueprint.getData().getEntrance()); | |||
} | |||
@@ -44,14 +44,18 @@ public class RenderSchedule<T extends ISchedule> implements IWorldRenderer | |||
private Region bb; | |||
private IWorldObject parentObject; | |||
private Collection<IDataIdentifier> dataIdsToRender; | |||
private Rotation rotation; | |||
public static RenderSchedule<ScheduleBlueprint> create(IWorldObject parentObject, final ScheduleBlueprint schedule) { | |||
public static RenderSchedule<ScheduleBlueprint> create(IWorldObject parentObject, final ScheduleBlueprint schedule) | |||
{ | |||
return new RenderSchedule<>(parentObject, schedule, schedule.getPalette().getIDs(), schedule.getColor(), schedule.getRotation()); | |||
} | |||
public static RenderSchedule<ScheduleEntranceHolder> create(IWorldObject parentObject, final ScheduleEntranceHolder schedule) { | |||
public static RenderSchedule<ScheduleEntranceHolder> create(IWorldObject parentObject, final ScheduleEntranceHolder schedule) | |||
{ | |||
Set<IDataIdentifier> id = Collections.singleton(schedule.getEntranceHolder()); | |||
return new RenderSchedule<>(parentObject, schedule, id, schedule.getColor(), schedule.getRotation()); | |||
} | |||
@@ -117,7 +121,8 @@ public class RenderSchedule<T extends ISchedule> implements IWorldRenderer | |||
PlayerOrbis playerOrbis = PlayerOrbis.get(Minecraft.getMinecraft().player); | |||
IGodPower power = playerOrbis.powers().getCurrentPower(); | |||
if (playerOrbis.getSelectedSchedule() == this.schedule && (power == playerOrbis.powers().getSelectPower() || power == playerOrbis.powers().getEntrancePower())) | |||
if (playerOrbis.getSelectedSchedule() == this.schedule && (power == playerOrbis.powers().getSelectPower() || power == playerOrbis.powers() | |||
.getEntrancePower())) | |||
{ | |||
boolean refresh = this.renderShape.boxAlpha == 0.25F; | |||
@@ -180,10 +185,10 @@ public class RenderSchedule<T extends ISchedule> implements IWorldRenderer | |||
OrbisCore.LOGGER.error(e); | |||
} | |||
} | |||
private void renderBlueprint(boolean useCamera, float partialTicks, RenderBlueprintBlocks blueprint) { | |||
private void renderBlueprint(boolean useCamera, float partialTicks, RenderBlueprintBlocks blueprint) | |||
{ | |||
final double offsetPlayerX = this.mc.player.lastTickPosX + (this.mc.player.posX - this.mc.player.lastTickPosX) * partialTicks; | |||
final double offsetPlayerY = this.mc.player.lastTickPosY + (this.mc.player.posY - this.mc.player.lastTickPosY) * partialTicks; | |||
final double offsetPlayerZ = this.mc.player.lastTickPosZ + (this.mc.player.posZ - this.mc.player.lastTickPosZ) * partialTicks; | |||
@@ -234,7 +234,8 @@ public class RenderScheduleLayer implements IWorldRenderer, IScheduleRecordListe | |||
r = RenderSchedule.create(this.parentObject, scheduleBlueprint); | |||
} | |||
else if (schedule instanceof ScheduleEntranceHolder) { | |||
else if (schedule instanceof ScheduleEntranceHolder) | |||
{ | |||
ScheduleEntranceHolder scheduleEntrance = (ScheduleEntranceHolder) schedule; | |||
r = RenderSchedule.create(this.parentObject, scheduleEntrance); | |||
@@ -247,7 +248,8 @@ public class RenderScheduleLayer implements IWorldRenderer, IScheduleRecordListe | |||
focused.setFocused(this.isFocused); | |||
} | |||
if (r != null) { | |||
if (r != null) | |||
{ | |||
this.subRenderers.add(r); | |||
} | |||
} | |||
@@ -1,7 +1,6 @@ | |||
package com.gildedgames.orbis.client.renderers.blueprint; | |||
import com.gildedgames.orbis.common.world_objects.Blueprint; | |||
import com.gildedgames.orbis.lib.block.BlockData; | |||
import com.gildedgames.orbis.lib.util.RegionHelp; | |||
import net.minecraft.block.material.Material; | |||
import net.minecraft.block.state.IBlockState; | |||
@@ -95,6 +95,7 @@ public class BlockOrbisFloor extends Block implements ModelRegisterCallback | |||
@Override | |||
public void registerModel() | |||
{ | |||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(new ResourceLocation(OrbisCore.MOD_ID, "orbis_floor"), "inventory")); | |||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, | |||
new ModelResourceLocation(new ResourceLocation(OrbisCore.MOD_ID, "orbis_floor"), "inventory")); | |||
} | |||
} |
@@ -256,7 +256,8 @@ public class PlayerOrbis implements IPlayerOrbis | |||
(EntityPlayerMP) other.getEntity()); | |||
} | |||
public PlayerBlueprintNetworkModule blueprintNetworks() { | |||
public PlayerBlueprintNetworkModule blueprintNetworks() | |||
{ | |||
return this.blueprintNetworkModule; | |||
} | |||
@@ -10,7 +10,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | |||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; | |||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; | |||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; | |||
import net.minecraftforge.fml.relauncher.Side; | |||
@Mod.EventBusSubscriber() | |||
public class PlayerOrbisEvents | |||
@@ -16,37 +16,37 @@ import java.util.List; | |||
@JEIPlugin | |||
public class OrbisJEIPlugin implements IModPlugin | |||
{ | |||
@Override | |||
public void register(IModRegistry registry) | |||
{ | |||
registry.addAdvancedGuiHandlers(new IAdvancedGuiHandler<GuiCombineMatrix>() | |||
{ | |||
@Override | |||
public Class<GuiCombineMatrix> getGuiContainerClass() | |||
{ | |||
return GuiCombineMatrix.class; | |||
} | |||
@Override | |||
public void register(IModRegistry registry) | |||
{ | |||
registry.addAdvancedGuiHandlers(new IAdvancedGuiHandler<GuiCombineMatrix>() | |||
{ | |||
@Override | |||
public Class<GuiCombineMatrix> getGuiContainerClass() | |||
{ | |||
return GuiCombineMatrix.class; | |||
} | |||
@Nullable | |||
@Override | |||
public List<Rectangle> getGuiExtraAreas(GuiCombineMatrix guiContainer) | |||
{ | |||
GuiTexture matrix = guiContainer.getMatrix(); | |||
GuiTexture flow = guiContainer.getFlow(); | |||
GuiAbstractButton forge = guiContainer.getForgeButton(); | |||
return Collections.singletonList( | |||
new Rectangle( | |||
(int) matrix.state().dim().x(), | |||
(int) matrix.state().dim().y(), | |||
(int) matrix.state().dim().width(), | |||
(int) ( | |||
matrix.state().dim().height() + | |||
flow.state().dim().height() + | |||
forge.state().dim().height() | |||
) | |||
) | |||
); | |||
} | |||
}); | |||
} | |||
@Nullable | |||
@Override | |||
public List<Rectangle> getGuiExtraAreas(GuiCombineMatrix guiContainer) | |||
{ | |||
GuiTexture matrix = guiContainer.getMatrix(); | |||
GuiTexture flow = guiContainer.getFlow(); | |||
GuiAbstractButton forge = guiContainer.getForgeButton(); | |||
return Collections.singletonList( | |||
new Rectangle( | |||
(int) matrix.state().dim().x(), | |||
(int) matrix.state().dim().y(), | |||
(int) matrix.state().dim().width(), | |||
(int) ( | |||
matrix.state().dim().height() + | |||
flow.state().dim().height() + | |||
forge.state().dim().height() | |||
) | |||
) | |||
); | |||
} | |||
}); | |||
} | |||
} |
@@ -1,6 +1,5 @@ | |||
package com.gildedgames.orbis.common.containers.slots; | |||
import com.gildedgames.orbis.lib.OrbisLib; | |||
import com.gildedgames.orbis.client.OrbisKeyBindings; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.network.packets.PacketSetItemStack; | |||
@@ -15,35 +15,40 @@ import java.util.UUID; | |||
public class DungeonViewer | |||
{ | |||
public DungeonViewer() { | |||
} | |||
@SubscribeEvent | |||
public void drawScreen(GuiOpenEvent event) { | |||
if (event.getGui() instanceof GuiInventory) { | |||
Optional<IProject> project = OrbisLib.services().getProjectManager().findProject("test"); | |||
if (project.isPresent()) { | |||
Optional<UUID> id = project.get().getCache().getDataId("networktest.blueprint"); | |||
if (id.isPresent()) { | |||
Optional<BlueprintData> data = project.get().getCache().getData(id.get()); | |||
data.ifPresent(blueprintData -> { | |||
BlueprintNetworkData network = | |||
new BlueprintNetworkData(5, | |||
Lists.newArrayList(blueprintData.getMetadata().getIdentifier()), | |||
Collections.emptyList(), | |||
Collections.emptyList(), | |||
Collections.emptyList()); | |||
//event.setGui(new GuiBlueprintNetworkViewer(network)); | |||
}); | |||
} | |||
} | |||
} | |||
} | |||
public DungeonViewer() | |||
{ | |||
} | |||
@SubscribeEvent | |||
public void drawScreen(GuiOpenEvent event) | |||
{ | |||
if (event.getGui() instanceof GuiInventory) | |||
{ | |||
Optional<IProject> project = OrbisLib.services().getProjectManager().findProject("test"); | |||
if (project.isPresent()) | |||
{ | |||
Optional<UUID> id = project.get().getCache().getDataId("networktest.blueprint"); | |||
if (id.isPresent()) | |||
{ | |||
Optional<BlueprintData> data = project.get().getCache().getData(id.get()); | |||
data.ifPresent(blueprintData -> { | |||
BlueprintNetworkData network = | |||
new BlueprintNetworkData(5, | |||
Lists.newArrayList(blueprintData.getMetadata().getIdentifier()), | |||
Collections.emptyList(), | |||
Collections.emptyList(), | |||
Collections.emptyList()); | |||
//event.setGui(new GuiBlueprintNetworkViewer(network)); | |||
}); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -15,34 +15,42 @@ import net.minecraft.client.renderer.GlStateManager; | |||
import net.minecraft.util.math.BlockPos; | |||
import java.io.IOException; | |||
import java.util.*; | |||
import java.util.Comparator; | |||
import java.util.List; | |||
public class GuiBlueprintNetworkViewer extends GuiViewerNoContainer | |||
{ | |||
private static class NodeToPaint { | |||
private static class NodeToPaint | |||
{ | |||
private IRegion region; | |||
private int color, zLevel; | |||
public NodeToPaint(IRegion region, int color, int zLevel) { | |||
public NodeToPaint(IRegion region, int color, int zLevel) | |||
{ | |||
this.region = region; | |||
this.color = color; | |||
this.zLevel = zLevel; | |||
} | |||
public int getColor() { | |||
return color; | |||
public int getColor() | |||
{ | |||
return this.color; | |||
} | |||
public IRegion getRegion() { | |||
return region; | |||
public IRegion getRegion() | |||
{ | |||
return this.region; | |||
} | |||
public Integer getZLevel() { | |||
public Integer getZLevel() | |||
{ | |||
return this.zLevel; | |||
} | |||
} | |||
private BlueprintNetworkData data; | |||
private BlueprintNetworkGenerator generator; | |||
private List<NodeToPaint> nodesToPaint = Lists.newArrayList(); | |||
@@ -66,7 +74,8 @@ public class GuiBlueprintNetworkViewer extends GuiViewerNoContainer | |||
} | |||
@Override | |||
public void build(IGuiContext context) { | |||
public void build(IGuiContext context) | |||
{ | |||
} | |||
@Override | |||
@@ -76,12 +85,14 @@ public class GuiBlueprintNetworkViewer extends GuiViewerNoContainer | |||
this.drawBackground(0xc2beb4); | |||
for (NodeToPaint node : this.nodesToPaint) { | |||
for (NodeToPaint node : this.nodesToPaint) | |||
{ | |||
this.paintRegion(node.getRegion(), node.getColor()); | |||
} | |||
} | |||
private void paintRegion(IRegion region, int color) { | |||
private void paintRegion(IRegion region, int color) | |||
{ | |||
BlockPos min = region.getMin(); | |||
int minX = min.getX(); | |||
int minY = min.getZ(); | |||
@@ -101,11 +112,16 @@ public class GuiBlueprintNetworkViewer extends GuiViewerNoContainer | |||
{ | |||
super.keyTyped(typedChar, keyCode); | |||
if (this.generator == null) { | |||
if (this.generator == null) | |||
{ | |||
this.nodesToPaint.clear(); | |||
this.generator = new BlueprintNetworkGenerator(this.data, new CreationData(Minecraft.getMinecraft().world), this.painter, (n, p) -> {}); | |||
} else { | |||
if (this.generator.step()) { | |||
this.generator = new BlueprintNetworkGenerator(this.data, new CreationData(Minecraft.getMinecraft().world), this.painter, (n, p) -> { | |||
}); | |||
} | |||
else | |||
{ | |||
if (this.generator.step()) | |||
{ | |||
this.generator = null; | |||
} | |||
} | |||
@@ -236,23 +236,28 @@ public class ItemBlueprint extends Item implements ModelRegisterCallback, ItemSt | |||
{ | |||
playerOrbis.powers().getBlueprintPower().setPrevPlacingPos(pos); | |||
if (Keyboard.isKeyDown(Keyboard.KEY_LMENU)) { | |||
if (Keyboard.isKeyDown(Keyboard.KEY_LMENU)) | |||
{ | |||
this.generateNetwork(playerOrbis, data); | |||
} else { | |||
} | |||
else | |||
{ | |||
this.generateBlueprint(playerOrbis, world, data); | |||
} | |||
} | |||
} | |||
} | |||
private void generateNetwork(PlayerOrbis playerOrbis, BlueprintData data) { | |||
private void generateNetwork(PlayerOrbis playerOrbis, BlueprintData data) | |||
{ | |||
final BlockPos createPos = playerOrbis.raytraceNoSnapping(); | |||
OrbisCore.network() | |||
.sendPacketToServer(new PacketGenerateBlueprintNetwork(data.getMetadata().getIdentifier(), createPos)); | |||
} | |||
private void generateBlueprint(PlayerOrbis playerOrbis, World world, BlueprintData data) { | |||
private void generateBlueprint(PlayerOrbis playerOrbis, World world, BlueprintData data) | |||
{ | |||
final BlockPos createPos = playerOrbis.raytraceNoSnapping(); | |||
final Rotation rotation = playerOrbis.powers().getBlueprintPower().getPlacingRotation(); | |||
@@ -270,9 +275,12 @@ public class ItemBlueprint extends Item implements ModelRegisterCallback, ItemSt | |||
boolean shouldAddEntrance = playerOrbis.powers().isEntrance() && data.getEntrance() != null; | |||
ISchedule schedule; | |||
if (shouldAddEntrance) { | |||
if (shouldAddEntrance) | |||
{ | |||
schedule = new ScheduleEntranceHolder("", data.getMetadata().getIdentifier(), scheduleBounds, rotation); | |||
} else { | |||
} | |||
else | |||
{ | |||
BlueprintDataPalette palette = new BlueprintDataPalette(); | |||
palette.add(data, new DataCondition()); | |||
@@ -1,9 +1,9 @@ | |||
package com.gildedgames.orbis.common.network.packets; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerClient; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerServer; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.player.godmode.selection_types.ISelectionType; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerClient; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerServer; | |||
import io.netty.buffer.ByteBuf; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | |||
@@ -1,7 +1,7 @@ | |||
package com.gildedgames.orbis.common.network.packets; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerServer; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerServer; | |||
import io.netty.buffer.ByteBuf; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | |||
@@ -1,9 +1,9 @@ | |||
package com.gildedgames.orbis.common.network.packets; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.lib.core.baking.BakedBlueprint; | |||
import com.gildedgames.orbis.lib.core.CreationData; | |||
import com.gildedgames.orbis.lib.core.ICreationData; | |||
import com.gildedgames.orbis.lib.core.baking.BakedBlueprint; | |||
import com.gildedgames.orbis.lib.data.blueprint.BlueprintData; | |||
import com.gildedgames.orbis.lib.data.region.IRegion; | |||
import com.gildedgames.orbis.lib.network.NetworkUtils; | |||
@@ -1,7 +1,7 @@ | |||
package com.gildedgames.orbis.common.network.packets; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerClient; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerClient; | |||
import io.netty.buffer.ByteBuf; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
import net.minecraft.entity.player.EntityPlayerMP; | |||
@@ -1,7 +1,6 @@ | |||
package com.gildedgames.orbis.common.network.packets; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.OrbisLib; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerClient; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerServer; | |||
import com.gildedgames.orbis.lib.world.IWorldObject; | |||
@@ -1,25 +1,10 @@ | |||
package com.gildedgames.orbis.common.network.packets.blueprints; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.world_objects.Blueprint; | |||
import com.gildedgames.orbis.lib.core.CreationData; | |||
import com.gildedgames.orbis.lib.data.blueprint.BlueprintData; | |||
import com.gildedgames.orbis.lib.data.blueprint.BlueprintNetworkData; | |||
import com.gildedgames.orbis.lib.data.management.IData; | |||
import com.gildedgames.orbis.lib.data.management.IDataIdentifier; | |||
import com.gildedgames.orbis.lib.data.schedules.ISchedule; | |||
import com.gildedgames.orbis.lib.network.NetworkUtils; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerClient; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerServer; | |||
import com.gildedgames.orbis.lib.processing.BlockAccessExtendedWrapper; | |||
import com.gildedgames.orbis.lib.processing.BlueprintNetworkGenerator; | |||
import com.gildedgames.orbis.lib.processing.DataPrimer; | |||
import com.gildedgames.orbis.lib.util.io.NBTFunnel; | |||
import com.gildedgames.orbis.lib.world.IWorldObject; | |||
import com.gildedgames.orbis.lib.world.WorldObjectManager; | |||
import com.gildedgames.orbis.lib.world.WorldObjectUtils; | |||
import com.google.common.collect.Lists; | |||
import io.netty.buffer.ByteBuf; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
import net.minecraft.nbt.NBTTagCompound; | |||
@@ -27,9 +12,6 @@ import net.minecraft.util.math.BlockPos; | |||
import net.minecraftforge.fml.common.network.ByteBufUtils; | |||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | |||
import java.util.Collections; | |||
import java.util.Optional; | |||
public class PacketGenerateBlueprintNetwork implements IMessage | |||
{ | |||
@@ -82,7 +64,8 @@ public class PacketGenerateBlueprintNetwork implements IMessage | |||
PlayerOrbis playerOrbis = PlayerOrbis.get(player); | |||
if (playerOrbis != null) { | |||
if (playerOrbis != null) | |||
{ | |||
playerOrbis.blueprintNetworks().addNewNetwork(message.id, message.pos); | |||
} | |||
@@ -5,7 +5,6 @@ import com.gildedgames.orbis.common.world_objects.Blueprint; | |||
import com.gildedgames.orbis.lib.data.blueprint.BlueprintData; | |||
import com.gildedgames.orbis.lib.data.management.IData; | |||
import com.gildedgames.orbis.lib.data.management.IDataIdentifier; | |||
import com.gildedgames.orbis.lib.data.pathway.Entrance; | |||
import com.gildedgames.orbis.lib.network.NetworkUtils; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerClient; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerServer; | |||
@@ -1,7 +1,6 @@ | |||
package com.gildedgames.orbis.common.network.packets.projects; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.lib.OrbisLib; | |||
import com.gildedgames.orbis.lib.network.instances.MessageHandlerServer; | |||
import com.gildedgames.orbis.lib.network.util.PacketMultipleParts; | |||
import io.netty.buffer.ByteBuf; | |||
@@ -16,7 +16,6 @@ import com.gildedgames.orbis.common.world_objects.Framework; | |||
import com.gildedgames.orbis.lib.data.blueprint.BlueprintData; | |||
import com.gildedgames.orbis.lib.data.blueprint.BlueprintDataPalette; | |||
import com.gildedgames.orbis.lib.data.framework.FrameworkNode; | |||
import com.gildedgames.orbis.lib.data.region.IShape; | |||
import com.gildedgames.orbis.lib.util.RegionHelp; | |||
import com.gildedgames.orbis.lib.world.WorldObjectUtils; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
@@ -1,9 +1,9 @@ | |||
package com.gildedgames.orbis.common.player.godmode.selection_types; | |||
import com.gildedgames.orbis.lib.data.region.IShape; | |||
import com.gildedgames.orbis.lib.util.mc.NBT; | |||
import com.gildedgames.orbis.client.godmode.selection_types.ISelectionTypeClient; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.lib.data.region.IShape; | |||
import com.gildedgames.orbis.lib.util.mc.NBT; | |||
import net.minecraft.util.math.BlockPos; | |||
public interface ISelectionType extends NBT | |||
@@ -1,11 +1,11 @@ | |||
package com.gildedgames.orbis.common.player.godmode.selection_types; | |||
import com.gildedgames.orbis.lib.data.region.IShape; | |||
import com.gildedgames.orbis.lib.data.shapes.DomeShape; | |||
import com.gildedgames.orbis.client.godmode.selection_types.ISelectionTypeClient; | |||
import com.gildedgames.orbis.client.godmode.selection_types.SelectionTypeClientDome; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.lib.data.region.IShape; | |||
import com.gildedgames.orbis.lib.data.shapes.DomeShape; | |||
import net.minecraft.nbt.NBTTagCompound; | |||
import net.minecraft.util.math.BlockPos; | |||
@@ -1,11 +1,11 @@ | |||
package com.gildedgames.orbis.common.player.godmode.selection_types; | |||
import com.gildedgames.orbis.lib.data.region.IShape; | |||
import com.gildedgames.orbis.lib.data.shapes.LineShape; | |||
import com.gildedgames.orbis.client.godmode.selection_types.ISelectionTypeClient; | |||
import com.gildedgames.orbis.client.godmode.selection_types.SelectionTypeClientLine; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.lib.data.region.IShape; | |||
import com.gildedgames.orbis.lib.data.shapes.LineShape; | |||
import net.minecraft.nbt.NBTTagCompound; | |||
import net.minecraft.util.math.BlockPos; | |||
@@ -85,9 +85,12 @@ public class ShapeSelectorEntrance implements IShapeSelector | |||
EnumFacingMultiple facing; | |||
if (entity.rotationPitch > 65 || entity.rotationPitch < -65) { | |||
if (entity.rotationPitch > 65 || entity.rotationPitch < -65) | |||
{ | |||
facing = entity.rotationPitch > 65 ? EnumFacingMultiple.DOWN : EnumFacingMultiple.UP; | |||
} else { | |||
} | |||
else | |||
{ | |||
facing = EnumFacingMultiple.getFromMultiple(entity.getHorizontalFacing()); | |||
} | |||
@@ -26,7 +26,8 @@ public class PlayerBlueprintNetworkModule extends PlayerOrbisModule | |||
super(playerOrbis); | |||
} | |||
public void addNewNetwork(IDataIdentifier id, BlockPos pos) { | |||
public void addNewNetwork(IDataIdentifier id, BlockPos pos) | |||
{ | |||
BlueprintNetworkData network = | |||
new BlueprintNetworkData(5, | |||
Lists.newArrayList(id), | |||
@@ -35,7 +36,8 @@ public class PlayerBlueprintNetworkModule extends PlayerOrbisModule | |||
Collections.emptyList()); | |||
DataPrimer primer = new DataPrimer(new BlockAccessExtendedWrapper(this.getWorld())); | |||
BlueprintNetworkGenerator generator = new BlueprintNetworkGenerator(network, new CreationData(this.getWorld()).pos(pos), (r, c, z) -> {}, primer::place); | |||
BlueprintNetworkGenerator generator = new BlueprintNetworkGenerator(network, new CreationData(this.getWorld()).pos(pos), (r, c, z) -> { | |||
}, primer::place); | |||
this.generators.add(generator); | |||
} | |||
@@ -43,7 +45,8 @@ public class PlayerBlueprintNetworkModule extends PlayerOrbisModule | |||
@Override | |||
public void onUpdate() | |||
{ | |||
if (this.getPlayer().getEntity().ticksExisted % 3 == 0) { | |||
if (this.getPlayer().getEntity().ticksExisted % 3 == 0) | |||
{ | |||
this.generators.removeIf(BlueprintNetworkGenerator::step); | |||
} | |||
} | |||
@@ -134,11 +134,13 @@ public class PlayerPowerModule extends PlayerOrbisModule | |||
return this.powers[this.currentPowerIndex]; | |||
} | |||
public boolean isEntrance() { | |||
public boolean isEntrance() | |||
{ | |||
return this.getCurrentPower() == this.getEntrancePower(); | |||
} | |||
public boolean isBlueprint() { | |||
public boolean isBlueprint() | |||
{ | |||
return this.getCurrentPower() == this.getBlueprintPower(); | |||
} | |||
@@ -1,6 +1,5 @@ | |||
package com.gildedgames.orbis.common.player.modules; | |||
import com.gildedgames.orbis.lib.OrbisLib; | |||
import com.gildedgames.orbis.common.OrbisCore; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbisModule; | |||
@@ -5,7 +5,6 @@ import com.gildedgames.orbis.common.capabilities.player.PlayerOrbis; | |||
import com.gildedgames.orbis.common.capabilities.player.PlayerOrbisModule; | |||
import com.gildedgames.orbis.common.network.packets.PacketChangeSelectionType; | |||
import com.gildedgames.orbis.common.player.godmode.selection_types.*; | |||
import com.gildedgames.orbis.lib.OrbisLib; | |||
import net.minecraft.nbt.NBTTagCompound; | |||
import java.util.ArrayList; | |||
@@ -3,7 +3,6 @@ package com.gildedgames.orbis.common.util; | |||
import com.gildedgames.orbis.common.world.orbis_instance.WorldProviderOrbis; | |||
import com.gildedgames.orbis.lib.core.CreationData; | |||
import com.gildedgames.orbis.lib.world.WorldObjectUtils; | |||
import net.minecraft.block.state.IBlockState; | |||
import net.minecraft.entity.player.EntityPlayer; | |||
import net.minecraft.util.math.BlockPos; | |||
import net.minecraft.world.World; | |||
@@ -6,234 +6,234 @@ import java.util.Iterator; | |||
public class FixedStack<E> implements Collection<E> | |||
{ | |||
private int maxSize, size = 0, maxIndex = -1; | |||
private Object[] elementData; | |||
public FixedStack(int maxSize) | |||
{ | |||
super(); | |||
this.maxSize = maxSize; | |||
this.elementData = new Object[maxSize]; | |||
} | |||
public int maxSize() | |||
{ | |||
return this.maxSize; | |||
} | |||
@Override | |||
public int size() | |||
{ | |||
return this.size; | |||
} | |||
@Override | |||
public boolean isEmpty() | |||
{ | |||
return false; | |||
} | |||
@Override | |||
public boolean contains(Object o) | |||
{ | |||
for (final Object o2 : this.elementData) | |||
{ | |||
if (o == o2) | |||
{ | |||
return true; | |||
} | |||
} | |||
return false; | |||
} | |||
@Override | |||
public Iterator<E> iterator() | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public Object[] toArray() | |||
{ | |||
return Arrays.copyOf(this.elementData, this.size); | |||
} | |||
@Override | |||
public <T> T[] toArray(T[] a) | |||
{ | |||
return null; | |||
} | |||
public boolean push(E e) | |||
{ | |||
return this.add(e); | |||
} | |||
@Override | |||
public boolean add(E e) | |||
{ | |||
++this.maxIndex; | |||
if (this.maxIndex >= this.maxSize) | |||
{ | |||
this.maxIndex = 0; | |||
} | |||
if (this.size < this.maxSize) | |||
{ | |||
++this.size; | |||
} | |||
this.elementData[this.maxIndex] = e; | |||
return true; | |||
} | |||
public E pop() | |||
{ | |||
if (this.size <= 0) | |||
{ | |||
return null; | |||
} | |||
@SuppressWarnings("unchecked") final E toPop = (E) this.elementData[this.maxIndex]; | |||
this.elementData[this.maxIndex] = null; | |||
--this.size; | |||
--this.maxIndex; | |||
if (this.maxIndex < 0 && this.size > 0) | |||
{ | |||
this.maxIndex = this.maxSize - 1; | |||
} | |||
return toPop; | |||
} | |||
public E peek() | |||
{ | |||
if (this.size <= 0) | |||
{ | |||
return null; | |||
} | |||
@SuppressWarnings("unchecked") final E toPeek = (E) this.elementData[this.maxIndex]; | |||
return toPeek; | |||
} | |||
@Override | |||
public boolean remove(Object o) | |||
{ | |||
return false; | |||
} | |||
@Override | |||
public boolean containsAll(Collection<?> c) | |||
{ | |||
outerloop: | |||
for (final Object o : c) | |||
{ | |||
for (final Object o2 : this.elementData) | |||
{ | |||
if (o == o2) | |||
{ | |||
continue outerloop; | |||
} | |||
} | |||
return false; | |||
} | |||
return true; | |||
} | |||
@Override | |||
public boolean addAll(Collection<? extends E> c) | |||
{ | |||
for (final E o : c) | |||
{ | |||
this.add(o); | |||
} | |||
return true; | |||
} | |||
@Override | |||
public boolean removeAll(Collection<?> c) | |||
{ | |||
// TODO Auto-generated method stub | |||
return false; | |||
} | |||
@Override | |||
public boolean retainAll(Collection<?> c) | |||
{ | |||
// TODO Auto-generated method stub | |||
return false; | |||
} | |||
@Override | |||
public void clear() | |||
{ | |||
for (int i = 0; i < this.maxSize; i++) | |||
{ | |||
this.elementData[i] = null; | |||
} | |||
this.size = 0; | |||
this.maxIndex = -1; | |||
} | |||
/** | |||
* Changes the maximum size of the stack. | |||
* Warning: It looks like it doesn't work. | |||
* @param newSize | |||
*/ | |||
public void setMaxSize(int newSize) | |||
{ | |||
if (newSize == this.maxSize) | |||
{ | |||
return; | |||
} | |||
if (this.maxSize < newSize) | |||
{ | |||
final Object[] copy = new Object[newSize]; | |||
int index = 0; | |||
for (int i = this.maxIndex + 1; i < this.maxSize; i++) | |||
{ | |||
copy[index] = this.elementData[i]; | |||
++index; | |||
} | |||
for (int i = 0; i <= this.maxIndex; i++) | |||
{ | |||
copy[index] = this.elementData[i]; | |||
++index; | |||
} | |||
this.maxIndex = this.maxSize - 1; | |||
this.elementData = copy; | |||
} | |||
else | |||
{ | |||
final Object[] copy = new Object[newSize];//Copy is never read! | |||
int index = newSize - 1; | |||
for (int i = this.maxIndex; i >= 0; i--) | |||
{ | |||
if (index >= 0) | |||
{ | |||
copy[index] = this.elementData[i]; | |||
--index; | |||
} | |||
else | |||
{ | |||
break; | |||
} | |||
} | |||
for (int i = this.maxSize - 1; i > this.maxIndex; i--) | |||
{ | |||
if (index >= 0) | |||
{ | |||
copy[index] = this.elementData[i]; | |||
--index; | |||
} | |||
else | |||
{ | |||
break; | |||
} | |||
} | |||
} | |||
this.maxSize = newSize; | |||
} | |||
private int maxSize, size = 0, maxIndex = -1; | |||
private Object[] elementData; | |||
public FixedStack(int maxSize) | |||
{ | |||
super(); | |||
this.maxSize = maxSize; | |||
this.elementData = new Object[maxSize]; | |||
} | |||
public int maxSize() | |||
{ | |||
return this.maxSize; | |||
} | |||
@Override | |||
public int size() | |||
{ | |||
return this.size; | |||
} | |||
@Override | |||
public boolean isEmpty() | |||
{ | |||
return false; | |||
} | |||
@Override | |||
public boolean contains(Object o) | |||
{ | |||
for (final Object o2 : this.elementData) | |||
{ | |||
if (o == o2) | |||
{ | |||
return true; | |||
} | |||
} | |||
return false; | |||
} | |||
@Override | |||
public Iterator<E> iterator() | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public Object[] toArray() | |||
{ | |||
return Arrays.copyOf(this.elementData, this.size); | |||
} | |||
@Override | |||
public <T> T[] toArray(T[] a) | |||
{ | |||
return null; | |||
} | |||
public boolean push(E e) | |||
{ | |||
return this.add(e); | |||
} | |||
@Override | |||
public boolean add(E e) | |||
{ | |||
++this.maxIndex; | |||
if (this.maxIndex >= this.maxSize) | |||
{ | |||
this.maxIndex = 0; | |||
} | |||
if (this.size < this.maxSize) | |||
{ | |||
++this.size; | |||
} | |||
this.elementData[this.maxIndex] = e; | |||
return true; | |||
} | |||
public E pop() | |||
{ | |||
if (this.size <= 0) | |||
{ | |||
return null; | |||
} | |||
@SuppressWarnings("unchecked") final E toPop = (E) this.elementData[this.maxIndex]; | |||
this.elementData[this.maxIndex] = null; | |||
--this.size; | |||
--this.maxIndex; | |||
if (this.maxIndex < 0 && this.size > 0) | |||
{ | |||
this.maxIndex = this.maxSize - 1; | |||
} | |||
return toPop; | |||
} | |||
public E peek() | |||
{ | |||
if (this.size <= 0) | |||
{ | |||
return null; | |||
} | |||
@SuppressWarnings("unchecked") final E toPeek = (E) this.elementData[this.maxIndex]; | |||
return toPeek; | |||
} | |||
@Override | |||
public boolean remove(Object o) | |||
{ | |||
return false; | |||
} | |||
@Override | |||
public boolean containsAll(Collection<?> c) | |||
{ | |||
outerloop: | |||
for (final Object o : c) | |||
{ | |||
for (final Object o2 : this.elementData) | |||
{ | |||
if (o == o2) | |||
{ | |||
continue outerloop; | |||
} | |||
} | |||
return false; | |||
} | |||
return true; | |||
} | |||
@Override | |||
public boolean addAll(Collection<? extends E> c) | |||
{ | |||
for (final E o : c) | |||
{ | |||
this.add(o); | |||
} | |||
return true; | |||
} | |||
@Override | |||
public boolean removeAll(Collection<?> c) | |||
{ | |||
// TODO Auto-generated method stub | |||
return false; | |||
} | |||
@Override | |||
public boolean retainAll(Collection<?> c) | |||
{ | |||
// TODO Auto-generated method stub | |||
return false; | |||
} | |||
@Override | |||
public void clear() | |||
{ | |||
for (int i = 0; i < this.maxSize; i++) | |||
{ | |||
this.elementData[i] = null; | |||
} | |||
this.size = 0; | |||
this.maxIndex = -1; | |||
} | |||
/** | |||
* Changes the maximum size of the stack. | |||
* Warning: It looks like it doesn't work. | |||
* @param newSize | |||
*/ | |||
public void setMaxSize(int newSize) | |||
{ | |||
if (newSize == this.maxSize) | |||
{ | |||
return; | |||
} | |||
if (this.maxSize < newSize) | |||
{ | |||
final Object[] copy = new Object[newSize]; | |||
int index = 0; | |||
for (int i = this.maxIndex + 1; i < this.maxSize; i++) | |||
{ | |||
copy[index] = this.elementData[i]; | |||
++index; | |||
} | |||
for (int i = 0; i <= this.maxIndex; i++) | |||
{ | |||
copy[index] = this.elementData[i]; | |||
++index; | |||
} | |||
this.maxIndex = this.maxSize - 1; | |||
this.elementData = copy; | |||
} | |||
else | |||
{ | |||
final Object[] copy = new Object[newSize];//Copy is never read! | |||
int index = newSize - 1; | |||
for (int i = this.maxIndex; i >= 0; i--) | |||
{ | |||
if (index >= 0) | |||
{ | |||
copy[index] = this.elementData[i]; | |||
--index; | |||
} | |||
else | |||
{ | |||
break; | |||
} | |||
} | |||
for (int i = this.maxSize - 1; i > this.maxIndex; i--) | |||
{ | |||
if (index >= 0) | |||
{ | |||
copy[index] = this.elementData[i]; | |||
--index; | |||
} | |||
else | |||
{ | |||
break; | |||
} | |||
} | |||
} | |||
this.maxSize = newSize; | |||
} | |||
} |
@@ -1,7 +1,7 @@ | |||
package com.gildedgames.orbis.common.util; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import com.gildedgames.orbis.client.renderers.AirSelectionRenderer; | |||
import com.gildedgames.orbis.lib.world.IWorldRenderer; | |||
import net.minecraft.client.Minecraft; | |||
public class WorldRenderHelp | |||
@@ -7,7 +7,6 @@ import com.gildedgames.orbis.lib.block.BlockFilter; | |||
import com.gildedgames.orbis.lib.block.BlockFilterHelper; | |||
import com.gildedgames.orbis.lib.core.CreationData; | |||
import com.gildedgames.orbis.lib.core.ICreationData; | |||
import com.gildedgames.orbis.lib.core.baking.BakedBlueprint; | |||
import com.gildedgames.orbis.lib.data.region.IRegion; | |||
import com.gildedgames.orbis.lib.data.region.IShape; | |||
import com.gildedgames.orbis.lib.data.region.Region; | |||
@@ -60,7 +60,8 @@ public class WorldActionGenerateGhostBlockDataContainer implements IWorldAction | |||
this.creationData.pos(this.ghostBlockDataContainer.getMin()).world(world).rotation(rotation); | |||
} | |||
primer.copyBlocksIntoWorld(BlockPos.ORIGIN, this.ghostBlockDataContainer.getBlockDataContainer(), this.ghostBlockDataContainer, null, this.creationData); | |||
primer.copyBlocksIntoWorld(BlockPos.ORIGIN, this.ghostBlockDataContainer.getBlockDataContainer(), this.ghostBlockDataContainer, null, | |||
this.creationData); | |||
WorldObjectManager.get(world).removeObject(this.ghostBlockDataContainer); | |||
} | |||
@@ -126,7 +126,8 @@ public class Blueprint extends BlueprintRegion implements IWorldObject, IColored | |||
{ | |||
IEntrance e = this.getData().getEntrance(); | |||
if (e != null) { | |||
if (e != null) | |||
{ | |||
int minX = e.getBounds().getMin().getX() + this.getPos().getX(); | |||
int minY = e.getBounds().getMin().getY() + this.getPos().getY(); | |||
int minZ = e.getBounds().getMin().getZ() + this.getPos().getZ(); | |||
@@ -152,7 +153,8 @@ public class Blueprint extends BlueprintRegion implements IWorldObject, IColored | |||
{ | |||
IEntrance e = this.getData().getEntrance(); | |||
if (e != null) { | |||
if (e != null) | |||
{ | |||
int minX = e.getBounds().getMin().getX() + this.getPos().getX(); | |||
int minY = e.getBounds().getMin().getY() + this.getPos().getY(); | |||
int minZ = e.getBounds().getMin().getZ() + this.getPos().getZ(); | |||
@@ -326,7 +326,8 @@ public class Framework extends AbstractRegion implements IWorldObject, IColored, | |||
} | |||
@Override | |||
public Iterator<BlockPos.MutableBlockPos> iterator() { | |||
public Iterator<BlockPos.MutableBlockPos> iterator() | |||
{ | |||
return BlockPos.getAllInBoxMutable(this.min, this.max).iterator(); | |||
} | |||
} |
@@ -292,7 +292,8 @@ public class GhostBlockDataContainer extends AbstractRegion implements IMutableR | |||
} | |||
@Override | |||
public Iterator<BlockPos.MutableBlockPos> iterator() { | |||
public Iterator<BlockPos.MutableBlockPos> iterator() | |||
{ | |||
return BlockPos.getAllInBoxMutable(this.min, this.max).iterator(); | |||
} | |||
} |
@@ -5,15 +5,15 @@ | |||
}, | |||
"elements": [ | |||
{ | |||
"from": [0, 0, 0], | |||
"to": [16, 16, 16], | |||
"from": [ 0, 0, 0 ], | |||
"to": [ 16, 16, 16 ], | |||
"faces": { | |||
"north": {"uv": [0, 0, 16, 16], "texture": "#0", "cullface": "north", "tintindex": 0}, | |||
"east": {"uv": [0, 0, 16, 16], "texture": "#0", "cullface": "east", "tintindex": 0}, | |||
"south": {"uv": [0, 0, 16, 16], "texture": "#0", "cullface": "south", "tintindex": 0}, | |||
"west": {"uv": [0, 0, 16, 16], "texture": "#0", "cullface": "west", "tintindex": 0}, | |||
"up": {"uv": [0, 0, 16, 16], "texture": "#0", "cullface": "up", "tintindex": 0}, | |||
"down": {"uv": [0, 0, 16, 16], "texture": "#0", "cullface": "down", "tintindex": 0} | |||
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#0", "cullface": "north", "tintindex": 0 }, | |||
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#0", "cullface": "east", "tintindex": 0 }, | |||
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#0", "cullface": "south", "tintindex": 0 }, | |||
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#0", "cullface": "west", "tintindex": 0 }, | |||
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#0", "cullface": "up", "tintindex": 0 }, | |||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#0", "cullface": "down", "tintindex": 0 } | |||
} | |||
} | |||
] |
@@ -3,7 +3,6 @@ package orbis_core.data; | |||
import com.gildedgames.orbis.lib.data.blueprint.BlueprintData; | |||
import com.gildedgames.orbis.lib.data.framework.FrameworkData; | |||
import com.gildedgames.orbis.lib.data.framework.interfaces.IFrameworkNode; | |||
import com.gildedgames.orbis.lib.data.pathway.IEntrance; | |||
import com.gildedgames.orbis.lib.data.pathway.PathwayData; | |||
import com.gildedgames.orbis.lib.data.region.IMutableRegion; | |||
import net.minecraft.nbt.NBTTagCompound; | |||
@@ -32,9 +31,9 @@ public class ScheduleData implements IFrameworkNode | |||
public int getMaxEdges() | |||
{ | |||
return 0; | |||
// return this.blueprints.stream() | |||
// .mapToInt(b -> b.getEntrance().size()) | |||
// .max().getAsInt(); TODO: Entrances | |||
// return this.blueprints.stream() | |||
// .mapToInt(b -> b.getEntrance().size()) | |||
// .max().getAsInt(); TODO: Entrances | |||
} | |||
@Override | |||
@@ -56,10 +55,10 @@ public class ScheduleData implements IFrameworkNode | |||
List<PathwayData> pathways = new ArrayList<>(); | |||
for (BlueprintData b : this.blueprints) | |||
{ | |||
// for (IEntrance e : b.getEntrance()) TODO: Entrance | |||
// { | |||
// pathways.add(e.toConnectTo()); | |||
// } | |||
// for (IEntrance e : b.getEntrance()) TODO: Entrance | |||
// { | |||
// pathways.add(e.toConnectTo()); | |||
// } | |||
} | |||
return pathways; | |||
} | |||