Shifting Things Around

- Removed some old resources inherited from TMA
- Introduced a new package structure, grouping by modules rather than types
This commit is contained in:
simibubi 2019-07-23 12:54:53 +02:00
parent a9c710f81d
commit e943690baa
90 changed files with 355 additions and 343 deletions

View file

@ -1,13 +1,13 @@
package com.simibubi.create;
import com.simibubi.create.block.CreativeCrateBlock;
import com.simibubi.create.block.RenderingBlock;
import com.simibubi.create.block.SchematicTableBlock;
import com.simibubi.create.block.SchematicannonBlock;
import com.simibubi.create.block.symmetry.CrossPlaneSymmetryBlock;
import com.simibubi.create.block.symmetry.PlaneSymmetryBlock;
import com.simibubi.create.block.symmetry.TriplePlaneSymmetryBlock;
import com.simibubi.create.utility.IJustForRendering;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.block.RenderUtilityBlock;
import com.simibubi.create.modules.schematics.block.CreativeCrateBlock;
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
import com.simibubi.create.modules.symmetry.block.CrossPlaneSymmetryBlock;
import com.simibubi.create.modules.symmetry.block.PlaneSymmetryBlock;
import com.simibubi.create.modules.symmetry.block.TriplePlaneSymmetryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -18,8 +18,8 @@ import net.minecraftforge.registries.IForgeRegistry;
public enum AllBlocks {
SCHEMATICANNON(new SchematicannonBlock()),
SCHEMATICANNON_CONNECTOR(new RenderingBlock()),
SCHEMATICANNON_PIPE(new RenderingBlock()),
SCHEMATICANNON_CONNECTOR(new RenderUtilityBlock()),
SCHEMATICANNON_PIPE(new RenderUtilityBlock()),
CREATIVE_CRATE(new CreativeCrateBlock()),
SCHEMATIC_TABLE(new SchematicTableBlock()),
@ -43,7 +43,7 @@ public enum AllBlocks {
public static void registerItemBlocks(IForgeRegistry<Item> registry) {
for (AllBlocks block : values()) {
if (block.get() instanceof IJustForRendering)
if (block.get() instanceof IRenderUtilityBlock)
continue;
registry.register(new BlockItem(block.get(), AllItems.standardProperties())

View file

@ -1,9 +1,9 @@
package com.simibubi.create;
import com.simibubi.create.block.SchematicTableContainer;
import com.simibubi.create.block.SchematicannonContainer;
import com.simibubi.create.gui.SchematicTableScreen;
import com.simibubi.create.gui.SchematicannonScreen;
import com.simibubi.create.modules.schematics.block.SchematicTableContainer;
import com.simibubi.create.modules.schematics.block.SchematicTableScreen;
import com.simibubi.create.modules.schematics.block.SchematicannonContainer;
import com.simibubi.create.modules.schematics.block.SchematicannonScreen;
import net.minecraft.client.gui.IHasContainer;
import net.minecraft.client.gui.ScreenManager;

View file

@ -1,9 +1,9 @@
package com.simibubi.create;
import com.simibubi.create.item.BlueprintItem;
import com.simibubi.create.item.BlueprintAndQuillItem;
import com.simibubi.create.item.TreeFertilizerItem;
import com.simibubi.create.item.SymmetryWandItem;
import com.simibubi.create.modules.curiosities.item.TreeFertilizerItem;
import com.simibubi.create.modules.schematics.item.BlueprintAndQuillItem;
import com.simibubi.create.modules.schematics.item.BlueprintItem;
import com.simibubi.create.modules.symmetry.SymmetryWandItem;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Properties;

View file

@ -1,6 +1,10 @@
package com.simibubi.create.networking;
package com.simibubi.create;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.packet.NbtPacket;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket;
import com.simibubi.create.modules.schematics.packet.SchematicPlacePacket;
import com.simibubi.create.modules.schematics.packet.SchematicUploadPacket;
import com.simibubi.create.modules.symmetry.SymmetryEffectPacket;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.network.NetworkRegistry;

View file

@ -0,0 +1,21 @@
package com.simibubi.create;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public enum AllSpecialTextures {
Selection("selection.png");
public static final String ASSET_PATH = "textures/special/";
private ResourceLocation location;
private AllSpecialTextures(String filename) {
location = new ResourceLocation(Create.ID, ASSET_PATH + filename);
}
public void bind() {
Minecraft.getInstance().getTextureManager().bindTexture(location);
}
}

View file

@ -2,9 +2,9 @@ package com.simibubi.create;
import java.util.function.Supplier;
import com.simibubi.create.block.SchematicTableTileEntity;
import com.simibubi.create.block.SchematicannonRenderer;
import com.simibubi.create.block.SchematicannonTileEntity;
import com.simibubi.create.modules.schematics.block.SchematicTableTileEntity;
import com.simibubi.create.modules.schematics.block.SchematicannonRenderer;
import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.tileentity.TileEntity;

View file

@ -3,10 +3,11 @@ package com.simibubi.create;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.simibubi.create.networking.AllPackets;
import com.simibubi.create.schematic.BlueprintHandler;
import com.simibubi.create.schematic.SchematicHologram;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import com.simibubi.create.modules.schematics.ClientSchematicLoader;
import com.simibubi.create.modules.schematics.ServerSchematicLoader;
import com.simibubi.create.modules.schematics.client.BlueprintHandler;
import com.simibubi.create.modules.schematics.client.SchematicHologram;
import net.minecraft.block.Block;
import net.minecraft.client.settings.KeyBinding;
@ -62,7 +63,7 @@ public class Create {
new SchematicHologram();
new BlueprintHandler();
ScrollFixer.init();
TOOL_MENU = new KeyBinding("Tool Menu (Hold)", Keyboard.LALT, NAME);
TOOL_MENU = new KeyBinding("Tool Menu (Hold)", KeyboardHelper.LALT, NAME);
ClientRegistry.registerKeyBinding(TOOL_MENU);
});
}

View file

@ -1,14 +0,0 @@
package com.simibubi.create.block;
import com.simibubi.create.utility.IJustForRendering;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
public class RenderingBlock extends Block implements IJustForRendering {
public RenderingBlock() {
super(Properties.create(Material.AIR));
}
}

View file

@ -1,13 +0,0 @@
package com.simibubi.create.block.symmetry;
import com.simibubi.create.utility.IJustForRendering;
import net.minecraft.block.Block;
public class SymmetryBlock extends Block implements IJustForRendering {
public SymmetryBlock(Properties properties) {
super(properties);
}
}

View file

@ -0,0 +1,8 @@
package com.simibubi.create.foundation.block;
/**
* Blocks only registered for use in other blocks' renderers.
*/
public interface IRenderUtilityBlock {
}

View file

@ -0,0 +1,12 @@
package com.simibubi.create.foundation.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
public class RenderUtilityBlock extends Block implements IRenderUtilityBlock {
public RenderUtilityBlock() {
super(Properties.create(Material.AIR));
}
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.utility;
package com.simibubi.create.foundation.block;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
@ -6,9 +6,9 @@ import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
public abstract class TileEntitySynced extends TileEntity {
public abstract class SyncedTileEntity extends TileEntity {
public TileEntitySynced(TileEntityType<?> tileEntityTypeIn) {
public SyncedTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}

View file

@ -1,10 +1,10 @@
package com.simibubi.create.gui;
package com.simibubi.create.foundation.gui;
import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.gui.widgets.AbstractSimiWidget;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.widget.Widget;

View file

@ -1,9 +1,9 @@
package com.simibubi.create.gui;
package com.simibubi.create.foundation.gui;
import java.util.ArrayList;
import java.util.List;
import com.simibubi.create.gui.widgets.AbstractSimiWidget;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.Widget;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui;
package com.simibubi.create.foundation.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui;
package com.simibubi.create.foundation.gui;
import com.simibubi.create.Create;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui;
package com.simibubi.create.foundation.gui;
import java.util.function.Consumer;

View file

@ -1,11 +1,11 @@
package com.simibubi.create.gui;
package com.simibubi.create.foundation.gui;
import java.util.List;
import java.util.function.Consumer;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.Create;
import com.simibubi.create.schematic.tools.Tools;
import com.simibubi.create.modules.schematics.client.tools.Tools;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui.widgets;
package com.simibubi.create.foundation.gui.widgets;
import java.util.LinkedList;
import java.util.List;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.gui.widgets;
package com.simibubi.create.foundation.gui.widgets;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.gui.ScreenResources;
import com.simibubi.create.foundation.gui.ScreenResources;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.gui.widgets;
package com.simibubi.create.foundation.gui.widgets;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.gui.ScreenResources;
import com.simibubi.create.foundation.gui.ScreenResources;
public class Indicator extends AbstractSimiWidget {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui.widgets;
package com.simibubi.create.foundation.gui.widgets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;

View file

@ -1,8 +1,8 @@
package com.simibubi.create.gui.widgets;
package com.simibubi.create.foundation.gui.widgets;
import java.util.function.Consumer;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import net.minecraft.util.text.TextFormatting;
@ -64,7 +64,7 @@ public class ScrollInput extends AbstractSimiWidget {
return false;
int priorState = state;
int step = (int) Math.signum(delta) * (Keyboard.isKeyDown(Keyboard.LSHIFT) ? 5 : 1);
int step = (int) Math.signum(delta) * (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT) ? 5 : 1);
state += step;
clampState();

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui.widgets;
package com.simibubi.create.foundation.gui.widgets;
import java.util.ArrayList;
import java.util.List;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.networking;
package com.simibubi.create.foundation.packet;
import java.util.function.Supplier;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic;
package com.simibubi.create.foundation.type;
import net.minecraft.util.math.BlockPos;

View file

@ -0,0 +1,15 @@
package com.simibubi.create.foundation.type;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ServerWorld;
public class DimensionPos {
public ServerWorld world;
public BlockPos pos;
public DimensionPos(ServerPlayerEntity player, BlockPos pos) {
this.world = player.getServerWorld();
this.pos = pos;
}
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.utility;
package com.simibubi.create.foundation.utility;
import java.io.BufferedReader;
import java.io.IOException;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.utility;
package com.simibubi.create.foundation.utility;
import org.lwjgl.glfw.GLFW;
@ -7,7 +7,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class Keyboard {
public class KeyboardHelper {
public static final int PRESS = 1;
public static final int HOLD = 2;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.utility;
package com.simibubi.create.foundation.utility;
import java.util.function.Predicate;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.utility;
package com.simibubi.create.foundation.utility;
import org.lwjgl.opengl.GL11;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.item;
package com.simibubi.create.modules.curiosities.item;
import java.util.Collections;
import java.util.HashMap;
@ -6,7 +6,7 @@ import java.util.List;
import java.util.Random;
import java.util.function.Predicate;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -46,7 +46,7 @@ public class TreeFertilizerItem extends Item {
@Override
@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (Keyboard.isKeyDown(Keyboard.LSHIFT))
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT))
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "Tree won't grow? Try this on it."));
else
tooltip.add(new StringTextComponent(TextFormatting.DARK_GRAY + "< Hold Shift >"));

View file

@ -1,6 +1,6 @@
package com.simibubi.create;
package com.simibubi.create.modules.schematics;
import static com.simibubi.create.ServerSchematicLoader.MAX_PACKET_SIZE;
import static com.simibubi.create.modules.schematics.ServerSchematicLoader.MAX_PACKET_SIZE;
import java.io.IOException;
import java.io.InputStream;
@ -16,9 +16,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import com.simibubi.create.networking.SchematicUploadPacket;
import com.simibubi.create.networking.AllPackets;
import com.simibubi.create.utility.FilesHelper;
import com.simibubi.create.AllPackets;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.utility.FilesHelper;
import com.simibubi.create.modules.schematics.packet.SchematicUploadPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.StringTextComponent;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic;
package com.simibubi.create.modules.schematics;
import java.util.ArrayList;
import java.util.Collections;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic;
package com.simibubi.create.modules.schematics;
import java.util.Collections;
import java.util.List;
@ -8,6 +8,7 @@ import java.util.Set;
import java.util.function.Predicate;
import com.google.common.collect.ImmutableMap;
import com.simibubi.create.foundation.type.Cuboid;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View file

@ -1,4 +1,4 @@
package com.simibubi.create;
package com.simibubi.create.modules.schematics;
import java.io.IOException;
import java.io.OutputStream;
@ -14,10 +14,12 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
import com.simibubi.create.block.SchematicTableTileEntity;
import com.simibubi.create.item.BlueprintItem;
import com.simibubi.create.networking.SchematicUploadPacket.DimensionPos;
import com.simibubi.create.utility.FilesHelper;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.type.DimensionPos;
import com.simibubi.create.foundation.utility.FilesHelper;
import com.simibubi.create.modules.schematics.block.SchematicTableTileEntity;
import com.simibubi.create.modules.schematics.item.BlueprintItem;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.ServerPlayerEntity;

View file

@ -1,8 +1,8 @@
package com.simibubi.create.block;
package com.simibubi.create.modules.schematics.block;
import java.util.List;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -36,7 +36,7 @@ public class CreativeCrateBlock extends Block {
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
if (Keyboard.isKeyDown(Keyboard.LSHIFT)) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
tooltip.add(new StringTextComponent(TextFormatting.LIGHT_PURPLE + "Creative Item"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "Grants an attached " + TextFormatting.BLUE + "Schematicannon"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "unlimited access to blocks."));

View file

@ -1,8 +1,8 @@
package com.simibubi.create.block;
package com.simibubi.create.modules.schematics.block;
import java.util.List;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -49,7 +49,7 @@ public class SchematicTableBlock extends HorizontalBlock {
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
if (Keyboard.isKeyDown(Keyboard.LSHIFT)) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "Writes saved Schematics onto"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "an " + TextFormatting.BLUE + "Empty Schematic"));
} else

View file

@ -1,4 +1,4 @@
package com.simibubi.create.block;
package com.simibubi.create.modules.schematics.block;
import com.simibubi.create.AllContainers;
import com.simibubi.create.AllItems;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui;
package com.simibubi.create.modules.schematics.block;
import java.nio.file.Paths;
import java.util.List;
@ -6,11 +6,12 @@ import java.util.List;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create;
import com.simibubi.create.block.SchematicTableContainer;
import com.simibubi.create.gui.widgets.Label;
import com.simibubi.create.gui.widgets.SelectionScrollInput;
import com.simibubi.create.gui.widgets.ScrollInput;
import com.simibubi.create.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
import com.simibubi.create.foundation.gui.ScreenResources;
import com.simibubi.create.foundation.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.IHasContainer;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.block;
package com.simibubi.create.modules.schematics.block;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.utility.TileEntitySynced;
import com.simibubi.create.foundation.block.SyncedTileEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
@ -15,7 +15,7 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.items.ItemStackHandler;
public class SchematicTableTileEntity extends TileEntitySynced implements ITickableTileEntity, INamedContainerProvider {
public class SchematicTableTileEntity extends SyncedTileEntity implements ITickableTileEntity, INamedContainerProvider {
public SchematicTableInventory inventory;
public boolean isUploading;

View file

@ -1,9 +1,9 @@
package com.simibubi.create.block;
package com.simibubi.create.modules.schematics.block;
import java.util.List;
import com.simibubi.create.AllItems;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -49,7 +49,7 @@ public class SchematicannonBlock extends Block {
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
if (Keyboard.isKeyDown(Keyboard.LSHIFT)) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "Prints a deployed " + TextFormatting.BLUE + "Schematic"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "into the world using blocks from inventories"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "placed right next to it."));

View file

@ -1,4 +1,4 @@
package com.simibubi.create.block;
package com.simibubi.create.modules.schematics.block;
import com.simibubi.create.AllContainers;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.block;
package com.simibubi.create.modules.schematics.block;
import java.util.Random;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui;
package com.simibubi.create.modules.schematics.block;
import java.util.Collections;
import java.util.List;
@ -7,14 +7,14 @@ import java.util.Vector;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.block.SchematicannonContainer;
import com.simibubi.create.block.SchematicannonTileEntity;
import com.simibubi.create.gui.widgets.Indicator;
import com.simibubi.create.gui.widgets.Indicator.State;
import com.simibubi.create.gui.widgets.IconButton;
import com.simibubi.create.networking.ConfigureSchematicannonPacket;
import com.simibubi.create.networking.ConfigureSchematicannonPacket.Option;
import com.simibubi.create.networking.AllPackets;
import com.simibubi.create.AllPackets;
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
import com.simibubi.create.foundation.gui.ScreenResources;
import com.simibubi.create.foundation.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.widgets.Indicator;
import com.simibubi.create.foundation.gui.widgets.Indicator.State;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket.Option;
import net.minecraft.client.gui.widget.Widget;
import net.minecraft.client.renderer.RenderHelper;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.block;
package com.simibubi.create.modules.schematics.block;
import java.util.HashMap;
import java.util.LinkedList;
@ -7,11 +7,11 @@ import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.item.BlueprintItem;
import com.simibubi.create.schematic.Cuboid;
import com.simibubi.create.schematic.MaterialChecklist;
import com.simibubi.create.schematic.SchematicWorld;
import com.simibubi.create.utility.TileEntitySynced;
import com.simibubi.create.foundation.block.SyncedTileEntity;
import com.simibubi.create.foundation.type.Cuboid;
import com.simibubi.create.modules.schematics.MaterialChecklist;
import com.simibubi.create.modules.schematics.SchematicWorld;
import com.simibubi.create.modules.schematics.item.BlueprintItem;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -49,7 +49,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
public class SchematicannonTileEntity extends TileEntitySynced implements ITickableTileEntity, INamedContainerProvider {
public class SchematicannonTileEntity extends SyncedTileEntity implements ITickableTileEntity, INamedContainerProvider {
public static final int NEIGHBOUR_CHECKING = 100;
public static final int PLACEMENT_DELAY = 10;
@ -599,7 +599,9 @@ public class SchematicannonTileEntity extends TileEntitySynced implements ITicka
BlockState toReplace = world.getBlockState(pos);
boolean placingAir = state.getBlock() == Blocks.AIR;
if (toReplace.getBlockState() == state)
if (toReplace == state)
return false;
if (toReplace.getBlockHardness(world, pos) == -1)
return false;
if (pos.withinDistance(getPos(), 2f))
return false;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic;
package com.simibubi.create.modules.schematics.client;
import java.io.IOException;
import java.io.OutputStream;
@ -11,14 +11,14 @@ import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllItems;
import com.simibubi.create.gui.ScreenOpener;
import com.simibubi.create.gui.TextInputPromptScreen;
import com.simibubi.create.utility.FilesHelper;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.utility.RaycastHelper;
import com.simibubi.create.utility.RaycastHelper.PredicateTraceResult;
import com.simibubi.create.utility.TessellatorHelper;
import com.simibubi.create.utility.TessellatorTextures;
import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.gui.TextInputPromptScreen;
import com.simibubi.create.foundation.utility.FilesHelper;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import com.simibubi.create.foundation.utility.RaycastHelper;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
@ -77,7 +77,7 @@ public class BlueprintAndQuillHandler {
return;
if (!active())
return;
if (!Keyboard.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL))
if (!KeyboardHelper.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL))
return;
int delta = (int) event.getScrollDelta();
if (secondPos == null)
@ -111,7 +111,7 @@ public class BlueprintAndQuillHandler {
@SubscribeEvent
public static void onClick(MouseInputEvent event) {
if (event.getAction() != Keyboard.PRESS)
if (event.getAction() != KeyboardHelper.PRESS)
return;
if (event.getButton() != 1)
return;
@ -232,7 +232,7 @@ public class BlueprintAndQuillHandler {
GlStateManager.enableTexture();
TessellatorHelper.begin();
TessellatorTextures.SelectedRoom.bind();
AllSpecialTextures.Selection.bind();
TessellatorHelper.doubleFace(Tessellator.getInstance().getBuffer(), new BlockPos(faceMin),
new BlockPos(faceMax.subtract(faceMin)), 1 / 16f * selectedFace.getAxisDirection().getOffset(),
false, false, false);
@ -262,7 +262,7 @@ public class BlueprintAndQuillHandler {
ClientPlayerEntity player = Minecraft.getInstance().player;
selectedPos = null;
if (Keyboard.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
if (KeyboardHelper.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
selectedPos = new BlockPos(player.getEyePosition(Minecraft.getInstance().getRenderPartialTicks())
.add(player.getLookVec().scale(range)));
} else {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.gui;
package com.simibubi.create.modules.schematics.client;
import java.util.Collections;
import java.util.List;
@ -6,10 +6,11 @@ import java.util.List;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllItems;
import com.simibubi.create.gui.widgets.Label;
import com.simibubi.create.gui.widgets.SelectionScrollInput;
import com.simibubi.create.gui.widgets.ScrollInput;
import com.simibubi.create.schematic.BlueprintHandler;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.ScreenResources;
import com.simibubi.create.foundation.gui.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.item.ItemStack;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic;
package com.simibubi.create.modules.schematics.client;
import java.util.HashMap;
@ -7,16 +7,17 @@ import org.lwjgl.glfw.GLFW;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllPackets;
import com.simibubi.create.Create;
import com.simibubi.create.gui.BlueprintHotbarOverlay;
import com.simibubi.create.gui.ToolSelectionScreen;
import com.simibubi.create.item.BlueprintItem;
import com.simibubi.create.networking.NbtPacket;
import com.simibubi.create.networking.SchematicPlacePacket;
import com.simibubi.create.networking.AllPackets;
import com.simibubi.create.schematic.tools.Tools;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.utility.TessellatorHelper;
import com.simibubi.create.foundation.gui.ToolSelectionScreen;
import com.simibubi.create.foundation.packet.NbtPacket;
import com.simibubi.create.foundation.type.Cuboid;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.modules.schematics.SchematicWorld;
import com.simibubi.create.modules.schematics.client.tools.Tools;
import com.simibubi.create.modules.schematics.item.BlueprintItem;
import com.simibubi.create.modules.schematics.packet.SchematicPlacePacket;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
@ -189,7 +190,7 @@ public class BlueprintHandler {
public static void onClick(MouseInputEvent event) {
if (Minecraft.getInstance().currentScreen != null)
return;
if (event.getAction() != Keyboard.PRESS)
if (event.getAction() != KeyboardHelper.PRESS)
return;
if (event.getButton() != 1)
return;
@ -210,7 +211,7 @@ public class BlueprintHandler {
if (!instance.active)
return;
boolean released = event.getAction() == Keyboard.RELEASE;
boolean released = event.getAction() == KeyboardHelper.RELEASE;
ToolSelectionScreen toolSelection = instance.selectionScreen;
if (released && toolSelection.focused) {
@ -241,7 +242,7 @@ public class BlueprintHandler {
selectionScreen.cycle((int) delta);
return true;
}
if (Keyboard.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
if (KeyboardHelper.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
return currentTool.getTool().handleMouseWheel(delta);
}

View file

@ -1,6 +1,7 @@
package com.simibubi.create.gui;
package com.simibubi.create.modules.schematics.client;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.foundation.gui.ScreenResources;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic;
package com.simibubi.create.modules.schematics.client;
import java.nio.ByteBuffer;
import java.util.Arrays;
@ -9,6 +9,8 @@ import java.util.List;
import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.foundation.type.Cuboid;
import com.simibubi.create.modules.schematics.SchematicWorld;
import net.minecraft.block.BedBlock;
import net.minecraft.block.BlockState;

View file

@ -1,9 +1,9 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.util.math.BlockPos;
@ -24,7 +24,7 @@ public class DeployTool extends PlacementToolBase {
selectionRange = (int) blueprint.size.manhattanDistance(BlockPos.ZERO) / 2;
selectionRange = MathHelper.clamp(selectionRange, 1, 100);
}
selectIgnoreBlocks = Keyboard.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL);
selectIgnoreBlocks = KeyboardHelper.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL);
super.updateSelection();
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
public class FlipTool extends PlacementToolBase {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
public interface ISchematicTool {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
public class MoveTool extends PlacementToolBase {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
public class MoveVerticalTool extends PlacementToolBase {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
public class PlaceTool extends SchematicToolBase {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
public abstract class PlacementToolBase extends SchematicToolBase {

View file

@ -1,4 +1,4 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
import net.minecraft.util.Rotation;

View file

@ -1,12 +1,12 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.schematic.BlueprintHandler;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.utility.RaycastHelper;
import com.simibubi.create.utility.RaycastHelper.PredicateTraceResult;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import com.simibubi.create.foundation.utility.RaycastHelper;
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
import com.simibubi.create.modules.schematics.client.BlueprintHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
@ -97,7 +97,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
WorldRenderer.drawBoundingBox(min.getX() - 1 / 8d, min.getY() + 1 / 16d, min.getZ() - 1 / 8d,
max.getX() + 1 / 8d, max.getY() + 1 / 8d, max.getZ() + 1 / 8d, 1, 1, 1, 1);
if (schematicSelected && renderSelectedFace && Keyboard.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
if (schematicSelected && renderSelectedFace && KeyboardHelper.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
Vec3d vec = new Vec3d(selectedFace.getDirectionVec());
Vec3d center = new Vec3d(min.add(max)).scale(1 / 2f);
Vec3d radii = new Vec3d(max.subtract(min)).scale(1 / 2f);

View file

@ -1,11 +1,11 @@
package com.simibubi.create.schematic.tools;
package com.simibubi.create.modules.schematics.client.tools;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.gui.ScreenResources;
import com.simibubi.create.foundation.gui.ScreenResources;
import net.minecraft.util.text.TextFormatting;

View file

@ -1,8 +1,8 @@
package com.simibubi.create.item;
package com.simibubi.create.modules.schematics.item;
import java.util.List;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
@ -20,7 +20,7 @@ public class BlueprintAndQuillItem extends Item {
@Override
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (Keyboard.isKeyDown(Keyboard.LSHIFT)) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
TextFormatting gray = TextFormatting.GRAY;
TextFormatting blue = TextFormatting.BLUE;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.item;
package com.simibubi.create.modules.schematics.item;
import java.io.IOException;
import java.io.InputStream;
@ -10,9 +10,9 @@ import java.util.List;
import org.apache.commons.io.IOUtils;
import com.simibubi.create.AllItems;
import com.simibubi.create.gui.BlueprintEditScreen;
import com.simibubi.create.gui.ScreenOpener;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import com.simibubi.create.modules.schematics.client.BlueprintEditScreen;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
@ -67,7 +67,7 @@ public class BlueprintItem extends Item {
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (Keyboard.isKeyDown(Keyboard.LSHIFT)) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
TextFormatting gray = TextFormatting.GRAY;
tooltip.add(new StringTextComponent(gray + "Holds a structure to be printed"));
tooltip.add(new StringTextComponent(gray + "by the Schematicannon."));

View file

@ -1,9 +1,9 @@
package com.simibubi.create.networking;
package com.simibubi.create.modules.schematics.packet;
import java.util.function.Supplier;
import com.simibubi.create.block.SchematicannonTileEntity;
import com.simibubi.create.block.SchematicannonTileEntity.State;
import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity;
import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity.State;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.PacketBuffer;

View file

@ -1,8 +1,8 @@
package com.simibubi.create.networking;
package com.simibubi.create.modules.schematics.packet;
import java.util.function.Supplier;
import com.simibubi.create.item.BlueprintItem;
import com.simibubi.create.modules.schematics.item.BlueprintItem;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;

View file

@ -1,14 +1,14 @@
package com.simibubi.create.networking;
package com.simibubi.create.modules.schematics.packet;
import java.util.function.Supplier;
import com.simibubi.create.Create;
import com.simibubi.create.block.SchematicTableContainer;
import com.simibubi.create.foundation.type.DimensionPos;
import com.simibubi.create.modules.schematics.block.SchematicTableContainer;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ServerWorld;
import net.minecraftforge.fml.network.NetworkEvent.Context;
public class SchematicUploadPacket {
@ -79,14 +79,4 @@ public class SchematicUploadPacket {
});
}
public static class DimensionPos {
public ServerWorld world;
public BlockPos pos;
public DimensionPos(ServerPlayerEntity player, BlockPos pos) {
this.world = player.getServerWorld();
this.pos = pos;
}
}
}

View file

@ -1,11 +1,9 @@
package com.simibubi.create.networking;
package com.simibubi.create.modules.symmetry;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import com.simibubi.create.item.SymmetryHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.math.BlockPos;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.item;
package com.simibubi.create.modules.symmetry;
import java.util.Random;
@ -6,9 +6,9 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllItems;
import com.simibubi.create.item.symmetry.SymmetryElement;
import com.simibubi.create.item.symmetry.SymmetryEmptySlot;
import com.simibubi.create.utility.TessellatorHelper;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.modules.symmetry.mirror.EmptyMirror;
import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
@ -83,8 +83,8 @@ public class SymmetryHandler {
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
if (stackInSlot != null && AllItems.SYMMETRY_WAND.typeOf(stackInSlot)
&& SymmetryWandItem.isEnabled(stackInSlot)) {
SymmetryElement mirror = SymmetryWandItem.getMirror(stackInSlot);
if (mirror instanceof SymmetryEmptySlot)
SymmetryMirror mirror = SymmetryWandItem.getMirror(stackInSlot);
if (mirror instanceof EmptyMirror)
continue;
TessellatorHelper.prepareForDrawing();
@ -130,8 +130,8 @@ public class SymmetryHandler {
if (stackInSlot != null && AllItems.SYMMETRY_WAND.typeOf(stackInSlot)
&& SymmetryWandItem.isEnabled(stackInSlot)) {
SymmetryElement mirror = SymmetryWandItem.getMirror(stackInSlot);
if (mirror instanceof SymmetryEmptySlot)
SymmetryMirror mirror = SymmetryWandItem.getMirror(stackInSlot);
if (mirror instanceof EmptyMirror)
continue;
Random r = new Random();

View file

@ -1,19 +1,17 @@
package com.simibubi.create.item;
package com.simibubi.create.modules.symmetry;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.simibubi.create.gui.ScreenOpener;
import com.simibubi.create.gui.SymmetryWandScreen;
import com.simibubi.create.item.symmetry.SymmetryCrossPlane;
import com.simibubi.create.item.symmetry.SymmetryElement;
import com.simibubi.create.item.symmetry.SymmetryEmptySlot;
import com.simibubi.create.item.symmetry.SymmetryPlane;
import com.simibubi.create.networking.SymmetryEffectPacket;
import com.simibubi.create.utility.Keyboard;
import com.simibubi.create.networking.AllPackets;
import com.simibubi.create.AllPackets;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import com.simibubi.create.modules.symmetry.mirror.CrossPlaneMirror;
import com.simibubi.create.modules.symmetry.mirror.EmptyMirror;
import com.simibubi.create.modules.symmetry.mirror.PlaneMirror;
import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -55,7 +53,7 @@ public class SymmetryWandItem extends Item {
@Override
@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (Keyboard.isKeyDown(Keyboard.LSHIFT)) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "Perfectly mirrors your Block placement"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "across the configured planes."));
tooltip.add(new StringTextComponent(""));
@ -83,23 +81,23 @@ public class SymmetryWandItem extends Item {
checkNBT(wand);
CompoundNBT compound = wand.getTag().getCompound($SYMMETRY);
pos = pos.offset(context.getFace());
SymmetryElement previousElement = SymmetryElement.fromNBT(compound);
SymmetryMirror previousElement = SymmetryMirror.fromNBT(compound);
if (player.isSneaking()) {
if (!(previousElement instanceof SymmetryEmptySlot))
if (!(previousElement instanceof EmptyMirror))
wand.getTag().putBoolean($ENABLE, !isEnabled(wand));
return ActionResultType.SUCCESS;
}
wand.getTag().putBoolean($ENABLE, true);
Vec3d pos3d = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
SymmetryElement newElement = new SymmetryPlane(pos3d);
SymmetryMirror newElement = new PlaneMirror(pos3d);
if (previousElement instanceof SymmetryEmptySlot) {
if (previousElement instanceof EmptyMirror) {
newElement.setOrientation(
(player.getHorizontalFacing() == Direction.NORTH || player.getHorizontalFacing() == Direction.SOUTH)
? SymmetryPlane.Align.XY.ordinal()
: SymmetryPlane.Align.YZ.ordinal());
? PlaneMirror.Align.XY.ordinal()
: PlaneMirror.Align.YZ.ordinal());
newElement.enable = true;
player.sendStatusMessage(new StringTextComponent(TextFormatting.GREEN + "New Plane created"), true);
wand.getTag().putBoolean($ENABLE, true);
@ -107,18 +105,18 @@ public class SymmetryWandItem extends Item {
} else {
previousElement.setPosition(pos3d);
if (previousElement instanceof SymmetryPlane) {
if (previousElement instanceof PlaneMirror) {
previousElement.setOrientation((player.getHorizontalFacing() == Direction.NORTH
|| player.getHorizontalFacing() == Direction.SOUTH) ? SymmetryPlane.Align.XY.ordinal()
: SymmetryPlane.Align.YZ.ordinal());
|| player.getHorizontalFacing() == Direction.SOUTH) ? PlaneMirror.Align.XY.ordinal()
: PlaneMirror.Align.YZ.ordinal());
}
if (previousElement instanceof SymmetryCrossPlane) {
if (previousElement instanceof CrossPlaneMirror) {
float rotation = player.getRotationYawHead();
float abs = Math.abs(rotation % 90);
boolean diagonal = abs > 22 && abs < 45 + 22;
previousElement.setOrientation(
diagonal ? SymmetryCrossPlane.Align.D.ordinal() : SymmetryCrossPlane.Align.Y.ordinal());
diagonal ? CrossPlaneMirror.Align.D.ordinal() : CrossPlaneMirror.Align.Y.ordinal());
}
newElement = previousElement;
@ -150,7 +148,7 @@ public class SymmetryWandItem extends Item {
private static void checkNBT(ItemStack wand) {
if (!wand.hasTag() || !wand.getTag().contains($SYMMETRY)) {
wand.setTag(new CompoundNBT());
wand.getTag().put($SYMMETRY, new SymmetryEmptySlot(new Vec3d(0, 0, 0)).writeToNbt());
wand.getTag().put($SYMMETRY, new EmptyMirror(new Vec3d(0, 0, 0)).writeToNbt());
wand.getTag().putBoolean($ENABLE, false);
}
}
@ -160,9 +158,9 @@ public class SymmetryWandItem extends Item {
return stack.getTag().getBoolean($ENABLE);
}
public static SymmetryElement getMirror(ItemStack stack) {
public static SymmetryMirror getMirror(ItemStack stack) {
checkNBT(stack);
return SymmetryElement.fromNBT((CompoundNBT) stack.getTag().getCompound($SYMMETRY));
return SymmetryMirror.fromNBT((CompoundNBT) stack.getTag().getCompound($SYMMETRY));
}
public static void apply(World world, ItemStack wand, PlayerEntity player, BlockPos pos, BlockState block) {
@ -174,7 +172,7 @@ public class SymmetryWandItem extends Item {
Map<BlockPos, BlockState> blockSet = new HashMap<>();
blockSet.put(pos, block);
SymmetryElement symmetry = SymmetryElement.fromNBT((CompoundNBT) wand.getTag().getCompound($SYMMETRY));
SymmetryMirror symmetry = SymmetryMirror.fromNBT((CompoundNBT) wand.getTag().getCompound($SYMMETRY));
Vec3d mirrorPos = symmetry.getPosition();
if (mirrorPos.distanceTo(new Vec3d(pos)) > 50)
@ -222,7 +220,7 @@ public class SymmetryWandItem extends Item {
Map<BlockPos, BlockState> blockSet = new HashMap<>();
blockSet.put(pos, air);
SymmetryElement symmetry = SymmetryElement.fromNBT((CompoundNBT) wand.getTag().getCompound($SYMMETRY));
SymmetryMirror symmetry = SymmetryMirror.fromNBT((CompoundNBT) wand.getTag().getCompound($SYMMETRY));
Vec3d mirrorPos = symmetry.getPosition();
if (mirrorPos.distanceTo(new Vec3d(pos)) > 50)

View file

@ -1,19 +1,20 @@
package com.simibubi.create.gui;
package com.simibubi.create.modules.symmetry;
import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.gui.widgets.Label;
import com.simibubi.create.gui.widgets.SelectionScrollInput;
import com.simibubi.create.gui.widgets.ScrollInput;
import com.simibubi.create.item.SymmetryWandItem;
import com.simibubi.create.item.symmetry.SymmetryCrossPlane;
import com.simibubi.create.item.symmetry.SymmetryElement;
import com.simibubi.create.item.symmetry.SymmetryEmptySlot;
import com.simibubi.create.item.symmetry.SymmetryPlane;
import com.simibubi.create.item.symmetry.SymmetryTriplePlane;
import com.simibubi.create.networking.NbtPacket;
import com.simibubi.create.networking.AllPackets;
import com.simibubi.create.AllPackets;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.ScreenResources;
import com.simibubi.create.foundation.gui.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
import com.simibubi.create.foundation.packet.NbtPacket;
import com.simibubi.create.modules.symmetry.mirror.CrossPlaneMirror;
import com.simibubi.create.modules.symmetry.mirror.EmptyMirror;
import com.simibubi.create.modules.symmetry.mirror.PlaneMirror;
import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror;
import com.simibubi.create.modules.symmetry.mirror.TriplePlaneMirror;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.RenderHelper;
@ -35,7 +36,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
private ScrollInput areaAlign;
private Label labelAlign;
private SymmetryElement currentElement;
private SymmetryMirror currentElement;
private float animationProgress;
private ItemStack wand;
@ -43,8 +44,8 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
super();
currentElement = SymmetryWandItem.getMirror(wand);
if (currentElement instanceof SymmetryEmptySlot) {
currentElement = new SymmetryPlane(Vec3d.ZERO);
if (currentElement instanceof EmptyMirror) {
currentElement = new PlaneMirror(Vec3d.ZERO);
}
this.wand = wand;
animationProgress = 0;
@ -58,22 +59,22 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
labelType = new Label(topLeftX + 122, topLeftY + 15, "").colored(0xFFFFFFFF).withShadow();
labelAlign = new Label(topLeftX + 122, topLeftY + 35, "").colored(0xFFFFFFFF).withShadow();
int state = currentElement instanceof SymmetryTriplePlane ? 2
: currentElement instanceof SymmetryCrossPlane ? 1 : 0;
int state = currentElement instanceof TriplePlaneMirror ? 2
: currentElement instanceof CrossPlaneMirror ? 1 : 0;
areaType = new SelectionScrollInput(topLeftX + 119, topLeftY + 12, 70, 14)
.forOptions(SymmetryElement.TOOLTIP_ELEMENTS).titled("Type of Mirror").writingTo(labelType)
.forOptions(SymmetryMirror.TOOLTIP_ELEMENTS).titled("Type of Mirror").writingTo(labelType)
.setState(state);
areaType.calling(position -> {
switch (position) {
case 0:
currentElement = new SymmetryPlane(currentElement.getPosition());
currentElement = new PlaneMirror(currentElement.getPosition());
break;
case 1:
currentElement = new SymmetryCrossPlane(currentElement.getPosition());
currentElement = new CrossPlaneMirror(currentElement.getPosition());
break;
case 2:
currentElement = new SymmetryTriplePlane(currentElement.getPosition());
currentElement = new TriplePlaneMirror(currentElement.getPosition());
break;
default:
break;
@ -91,7 +92,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
}
private void initAlign(SymmetryElement element) {
private void initAlign(SymmetryMirror element) {
if (areaAlign != null) {
widgets.remove(areaAlign);
}

View file

@ -1,6 +1,6 @@
package com.simibubi.create.block.symmetry;
package com.simibubi.create.modules.symmetry.block;
import com.simibubi.create.item.symmetry.SymmetryCrossPlane;
import com.simibubi.create.modules.symmetry.mirror.CrossPlaneMirror;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -10,12 +10,12 @@ import net.minecraft.state.StateContainer.Builder;
public class CrossPlaneSymmetryBlock extends SymmetryBlock {
public static final EnumProperty<SymmetryCrossPlane.Align> align = EnumProperty.create("align",
SymmetryCrossPlane.Align.class);
public static final EnumProperty<CrossPlaneMirror.Align> align = EnumProperty.create("align",
CrossPlaneMirror.Align.class);
public CrossPlaneSymmetryBlock() {
super(Properties.create(Material.AIR));
this.setDefaultState(getDefaultState().with(align, SymmetryCrossPlane.Align.Y));
this.setDefaultState(getDefaultState().with(align, CrossPlaneMirror.Align.Y));
}
@Override

View file

@ -1,6 +1,6 @@
package com.simibubi.create.block.symmetry;
package com.simibubi.create.modules.symmetry.block;
import com.simibubi.create.item.symmetry.SymmetryPlane;
import com.simibubi.create.modules.symmetry.mirror.PlaneMirror;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -10,11 +10,11 @@ import net.minecraft.state.StateContainer.Builder;
public class PlaneSymmetryBlock extends SymmetryBlock {
public static final EnumProperty<SymmetryPlane.Align> align = EnumProperty.create("align", SymmetryPlane.Align.class);
public static final EnumProperty<PlaneMirror.Align> align = EnumProperty.create("align", PlaneMirror.Align.class);
public PlaneSymmetryBlock() {
super(Properties.create(Material.AIR));
this.setDefaultState(getDefaultState().with(align, SymmetryPlane.Align.XY));
this.setDefaultState(getDefaultState().with(align, PlaneMirror.Align.XY));
}
@Override

View file

@ -0,0 +1,13 @@
package com.simibubi.create.modules.symmetry.block;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import net.minecraft.block.Block;
public class SymmetryBlock extends Block implements IRenderUtilityBlock {
public SymmetryBlock(Properties properties) {
super(properties);
}
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.block.symmetry;
package com.simibubi.create.modules.symmetry.block;
import net.minecraft.block.material.Material;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.item.symmetry;
package com.simibubi.create.modules.symmetry.mirror;
import java.util.HashMap;
import java.util.List;
@ -6,14 +6,14 @@ import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.block.symmetry.CrossPlaneSymmetryBlock;
import com.simibubi.create.modules.symmetry.block.CrossPlaneSymmetryBlock;
import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
public class SymmetryCrossPlane extends SymmetryElement {
public class CrossPlaneMirror extends SymmetryMirror {
public static enum Align implements IStringSerializable {
Y("y"), D("d");
@ -35,7 +35,7 @@ public class SymmetryCrossPlane extends SymmetryElement {
}
}
public SymmetryCrossPlane(Vec3d pos) {
public CrossPlaneMirror(Vec3d pos) {
super(pos);
orientation = Align.Y;
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.item.symmetry;
package com.simibubi.create.modules.symmetry.mirror;
import java.util.HashMap;
import java.util.List;
@ -11,7 +11,7 @@ import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
public class SymmetryEmptySlot extends SymmetryElement {
public class EmptyMirror extends SymmetryMirror {
public static enum Align implements IStringSerializable {
None("none");
@ -22,7 +22,7 @@ public class SymmetryEmptySlot extends SymmetryElement {
@Override public String toString() { return name; }
}
public SymmetryEmptySlot(Vec3d pos) {
public EmptyMirror(Vec3d pos) {
super(pos);
orientation = Align.None;
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.item.symmetry;
package com.simibubi.create.modules.symmetry.mirror;
import java.util.HashMap;
import java.util.List;
@ -6,14 +6,14 @@ import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.block.symmetry.PlaneSymmetryBlock;
import com.simibubi.create.modules.symmetry.block.PlaneSymmetryBlock;
import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
public class SymmetryPlane extends SymmetryElement {
public class PlaneMirror extends SymmetryMirror {
public static enum Align implements IStringSerializable {
XY("xy"), YZ("yz");
@ -35,7 +35,7 @@ public class SymmetryPlane extends SymmetryElement {
}
}
public SymmetryPlane(Vec3d pos) {
public PlaneMirror(Vec3d pos) {
super(pos);
orientation = Align.XY;
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.item.symmetry;
package com.simibubi.create.modules.symmetry.mirror;
import java.util.HashMap;
import java.util.List;
@ -20,7 +20,7 @@ import net.minecraft.util.Mirror;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
public abstract class SymmetryElement {
public abstract class SymmetryMirror {
public static final String EMPTY = "empty";
public static final String PLANE = "plane";
@ -34,7 +34,7 @@ public abstract class SymmetryElement {
protected int orientationIndex;
public boolean enable;
public SymmetryElement(Vec3d pos) {
public SymmetryMirror(Vec3d pos) {
position = pos;
enable = true;
orientationIndex = 0;
@ -95,23 +95,23 @@ public abstract class SymmetryElement {
return nbt;
}
public static SymmetryElement fromNBT(CompoundNBT nbt) {
public static SymmetryMirror fromNBT(CompoundNBT nbt) {
ListNBT floatList = nbt.getList($POSITION, 5);
Vec3d pos = new Vec3d(floatList.getFloat(0), floatList.getFloat(1), floatList.getFloat(2));
SymmetryElement element;
SymmetryMirror element;
switch (nbt.getString($TYPE)) {
case PLANE:
element = new SymmetryPlane(pos);
element = new PlaneMirror(pos);
break;
case CROSS_PLANE:
element = new SymmetryCrossPlane(pos);
element = new CrossPlaneMirror(pos);
break;
case TRIPLE_PLANE:
element = new SymmetryTriplePlane(pos);
element = new TriplePlaneMirror(pos);
break;
default:
element = new SymmetryEmptySlot(pos);
element = new EmptyMirror(pos);
break;
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.item.symmetry;
package com.simibubi.create.modules.symmetry.mirror;
import java.util.HashMap;
import java.util.List;
@ -12,9 +12,9 @@ import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
public class SymmetryTriplePlane extends SymmetryElement {
public class TriplePlaneMirror extends SymmetryMirror {
public SymmetryTriplePlane(Vec3d pos) {
public TriplePlaneMirror(Vec3d pos) {
super(pos);
orientationIndex = 0;
}
@ -55,7 +55,7 @@ public class SymmetryTriplePlane extends SymmetryElement {
@Override
public IStringSerializable getOrientation() {
return SymmetryCrossPlane.Align.Y;
return CrossPlaneMirror.Align.Y;
}
@Override

View file

@ -1,5 +0,0 @@
package com.simibubi.create.utility;
public interface IJustForRendering {
}

View file

@ -1,29 +0,0 @@
package com.simibubi.create.utility;
import com.simibubi.create.Create;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public enum TessellatorTextures {
Room("inner.png"),
RoomTransparent("inner_transparent.png"),
SelectedRoom("inner_selected.png"),
SuperSelectedRoom("inner_super_selected.png"),
Selection("select.png"),
Exporter("exporter.png"),
Trim("trim.png");
private ResourceLocation location;
private TessellatorTextures(String filename) {
location = new ResourceLocation(Create.ID,
"textures/block/marker/" + filename);
}
public void bind() {
Minecraft.getInstance().getTextureManager().bindTexture(location);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B