diff --git a/build.gradle b/build.gradle index 5dc1fea2d..76690cae7 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ archivesBaseName = 'create' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' minecraft { - mappings channel: 'snapshot', version: '20190816-1.14.3' + mappings channel: 'snapshot', version: '20190825-1.14.3' runs { client { @@ -58,7 +58,7 @@ minecraft { } dependencies { - minecraft 'net.minecraftforge:forge:1.14.4-28.0.49' + minecraft 'net.minecraftforge:forge:1.14.4-28.0.55' } jar { diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index d95b7ecf3..6423356c9 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -25,9 +25,9 @@ import com.simibubi.create.modules.contraptions.relays.EncasedBeltBlock; import com.simibubi.create.modules.contraptions.relays.GearboxBlock; import com.simibubi.create.modules.contraptions.relays.GearshifterBlock; import com.simibubi.create.modules.gardens.CocoaLogBlock; -import com.simibubi.create.modules.logistics.FlexCrateBlock; +import com.simibubi.create.modules.logistics.FlexcrateBlock; import com.simibubi.create.modules.logistics.RedstoneBridgeBlock; -import com.simibubi.create.modules.logistics.StockpileSwitchBlock; +import com.simibubi.create.modules.logistics.StockswitchBlock; import com.simibubi.create.modules.schematics.block.CreativeCrateBlock; import com.simibubi.create.modules.schematics.block.SchematicTableBlock; import com.simibubi.create.modules.schematics.block.SchematicannonBlock; @@ -91,8 +91,8 @@ public enum AllBlocks { // Logistics REDSTONE_BRIDGE(new RedstoneBridgeBlock()), - STOCKPILE_SWITCH(new StockpileSwitchBlock()), - FLEX_CRATE(new FlexCrateBlock()), + STOCKSWITCH(new StockswitchBlock()), + FLEXCRATE(new FlexcrateBlock()), // Symmetry SYMMETRY_PLANE(new PlaneSymmetryBlock()), diff --git a/src/main/java/com/simibubi/create/AllContainers.java b/src/main/java/com/simibubi/create/AllContainers.java index 09bfa551c..4fcce3b8a 100644 --- a/src/main/java/com/simibubi/create/AllContainers.java +++ b/src/main/java/com/simibubi/create/AllContainers.java @@ -1,7 +1,7 @@ package com.simibubi.create; -import com.simibubi.create.modules.logistics.FlexCrateContainer; -import com.simibubi.create.modules.logistics.FlexCrateScreen; +import com.simibubi.create.modules.logistics.FlexcrateContainer; +import com.simibubi.create.modules.logistics.FlexcrateScreen; import com.simibubi.create.modules.schematics.block.SchematicTableContainer; import com.simibubi.create.modules.schematics.block.SchematicTableScreen; import com.simibubi.create.modules.schematics.block.SchematicannonContainer; @@ -28,7 +28,7 @@ public enum AllContainers { SchematicTable(SchematicTableContainer::new), Schematicannon(SchematicannonContainer::new), - FlexCrate(FlexCrateContainer::new), + FlexCrate(FlexcrateContainer::new), ; @@ -53,7 +53,7 @@ public enum AllContainers { public static void registerScreenFactories() { bind(SchematicTable, SchematicTableScreen::new); bind(Schematicannon, SchematicannonScreen::new); - bind(FlexCrate, FlexCrateScreen::new); + bind(FlexCrate, FlexcrateScreen::new); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 02562b5cc..b1e0a8261 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -21,9 +21,10 @@ import com.simibubi.create.modules.contraptions.relays.GearboxTileEntity; import com.simibubi.create.modules.contraptions.relays.GearboxTileEntityRenderer; import com.simibubi.create.modules.contraptions.relays.GearshifterTileEntity; import com.simibubi.create.modules.contraptions.relays.GearshifterTileEntityRenderer; -import com.simibubi.create.modules.logistics.FlexCrateTileEntity; +import com.simibubi.create.modules.logistics.FlexcrateTileEntity; import com.simibubi.create.modules.logistics.RedstoneBridgeTileEntity; -import com.simibubi.create.modules.logistics.StockpileSwitchTileEntity; +import com.simibubi.create.modules.logistics.RedstoneBridgeTileEntityRenderer; +import com.simibubi.create.modules.logistics.StockswitchTileEntity; import com.simibubi.create.modules.schematics.block.SchematicTableTileEntity; import com.simibubi.create.modules.schematics.block.SchematicannonRenderer; import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity; @@ -62,8 +63,8 @@ public enum AllTileEntities { // Logistics REDSTONE_BRIDGE(RedstoneBridgeTileEntity::new, AllBlocks.REDSTONE_BRIDGE), - STOCKPILE_SWITCH(StockpileSwitchTileEntity::new, AllBlocks.STOCKPILE_SWITCH), - FLEX_CRATE(FlexCrateTileEntity::new, AllBlocks.FLEX_CRATE), + STOCKSWITCH(StockswitchTileEntity::new, AllBlocks.STOCKSWITCH), + FLEXCRATE(FlexcrateTileEntity::new, AllBlocks.FLEXCRATE), ; @@ -105,6 +106,7 @@ public enum AllTileEntities { bind(DrillTileEntity.class, new KineticTileEntityRenderer()); bind(CrushingWheelTileEntity.class, new KineticTileEntityRenderer()); bind(WaterWheelTileEntity.class, new KineticTileEntityRenderer()); + bind(RedstoneBridgeTileEntity.class, new RedstoneBridgeTileEntityRenderer()); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java index 324eb96c9..1ec2a4129 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java @@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; public abstract class AbstractSimiScreen extends Screen { protected int sWidth, sHeight; - protected int topLeftX, topLeftY; + protected int guiLeft, guiTop; protected List widgets; protected AbstractSimiScreen() { @@ -26,8 +26,8 @@ public abstract class AbstractSimiScreen extends Screen { protected void setWindowSize(int width, int height) { sWidth = width; sHeight = height; - topLeftX = (this.width - sWidth) / 2; - topLeftY = (this.height - sHeight) / 2; + guiLeft = (this.width - sWidth) / 2; + guiTop = (this.height - sHeight) / 2; } @Override diff --git a/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java b/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java new file mode 100644 index 000000000..f622f5739 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java @@ -0,0 +1,55 @@ +package com.simibubi.create.foundation.gui; + +import java.util.function.Supplier; + +import com.mojang.blaze3d.platform.GlStateManager; + +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.item.ItemStack; + +public class ScreenElementRenderer { + + public static void render3DItem(Supplier transformsAndStack) { + GlStateManager.pushMatrix(); + + GlStateManager.enableBlend(); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableAlphaTest(); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + + ItemStack stack = transformsAndStack.get(); + + Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(stack, 0, 0); + GlStateManager.popMatrix(); + } + + public static void renderBlock(Supplier transformsAndState) { + GlStateManager.pushMatrix(); + + GlStateManager.enableBlend(); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableAlphaTest(); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.translated(0, 0, 200); + + BlockState toRender = transformsAndState.get(); + + GlStateManager.scaled(50, -50, 50); + Minecraft mc = Minecraft.getInstance(); + mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + mc.getBlockRendererDispatcher().renderBlockBrightness(toRender, 1); + + GlStateManager.disableAlphaTest(); + GlStateManager.disableRescaleNormal(); + + GlStateManager.popMatrix(); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/gui/ScreenResources.java b/src/main/java/com/simibubi/create/foundation/gui/ScreenResources.java index 833bf63b2..c65cc285a 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ScreenResources.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ScreenResources.java @@ -23,6 +23,17 @@ public enum ScreenResources { SCHEMATICANNON_HIGHLIGHT("schematicannon.png", 0, 182, 28, 28), SCHEMATICANNON_FUEL("schematicannon.png", 0, 215, 82, 4), + FLEXCRATE("flex_crate_and_stockpile_switch.png", 125, 129), + FLEXCRATE_LOCKED_SLOT("flex_crate_and_stockpile_switch.png", 138, 0, 18, 18), + + STOCKSWITCH("flex_crate_and_stockpile_switch.png", 0, 129, 205, 93), + STOCKSWITCH_INTERVAL("flex_crate_and_stockpile_switch.png", 0, 222, 198, 17), + STOCKSWITCH_INTERVAL_END("flex_crate_and_stockpile_switch.png", 0, 239, 198, 17), + STOCKSWITCH_CURSOR_ON("flex_crate_and_stockpile_switch.png", 218, 129, 8, 21), + STOCKSWITCH_CURSOR_OFF("flex_crate_and_stockpile_switch.png", 226, 129, 8, 21), + STOCKSWITCH_BOUND_LEFT("flex_crate_and_stockpile_switch.png", 234, 129, 7, 21), + STOCKSWITCH_BOUND_RIGHT("flex_crate_and_stockpile_switch.png", 241, 129, 7, 21), + // Widgets PALETTE_BUTTON("palette_picker.png", 0, 236, 20, 20), TEXT_INPUT("widgets.png", 0, 28, 194, 47), @@ -74,7 +85,9 @@ public enum ScreenResources { ICON_PATTERN_CHANCE_50("icons.png", 0, 112, 16, 16), ICON_PATTERN_CHANCE_75("icons.png", 16, 112, 16, 16), ICON_FOLLOW_DIAGONAL("icons.png", 32, 112, 16, 16), - ICON_FOLLOW_MATERIAL("icons.png", 48, 112, 16, 16); + ICON_FOLLOW_MATERIAL("icons.png", 48, 112, 16, 16), + + ; public static final int FONT_COLOR = 0x575F7A; @@ -92,8 +105,12 @@ public enum ScreenResources { this.startX = startX; this.startY = startY; } - public void draw(AbstractGui screen, int i, int j) { + public void bind() { Minecraft.getInstance().getTextureManager().bindTexture(location); + } + + public void draw(AbstractGui screen, int i, int j) { + bind(); screen.blit(i, j, startX, startY, width, height); } diff --git a/src/main/java/com/simibubi/create/foundation/gui/TextInputPromptScreen.java b/src/main/java/com/simibubi/create/foundation/gui/TextInputPromptScreen.java index 6fa8a552d..8b582a652 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/TextInputPromptScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/TextInputPromptScreen.java @@ -37,20 +37,20 @@ public class TextInputPromptScreen extends AbstractSimiScreen { super.init(); setWindowSize(ScreenResources.TEXT_INPUT.width, ScreenResources.TEXT_INPUT.height + 30); - this.nameField = new TextFieldWidget(font, topLeftX + 33, topLeftY + 26, 128, 8, ""); + this.nameField = new TextFieldWidget(font, guiLeft + 33, guiTop + 26, 128, 8, ""); this.nameField.setTextColor(-1); this.nameField.setDisabledTextColour(-1); this.nameField.setEnableBackgroundDrawing(false); this.nameField.setMaxStringLength(35); this.nameField.changeFocus(true); - confirm = new Button(topLeftX - 5, topLeftY + 50, 100, 20, buttonTextConfirm, button -> { + confirm = new Button(guiLeft - 5, guiTop + 50, 100, 20, buttonTextConfirm, button -> { callback.accept(nameField.getText()); confirmed = true; minecraft.displayGuiScreen(null); }); - abort = new Button(topLeftX + 100, topLeftY + 50, 100, 20, buttonTextAbort, button -> { + abort = new Button(guiLeft + 100, guiTop + 50, 100, 20, buttonTextAbort, button -> { minecraft.displayGuiScreen(null); }); @@ -61,8 +61,8 @@ public class TextInputPromptScreen extends AbstractSimiScreen { @Override public void renderWindow(int mouseX, int mouseY, float partialTicks) { - ScreenResources.TEXT_INPUT.draw(this, topLeftX, topLeftY); - font.drawString(title, topLeftX + (sWidth / 2) - (font.getStringWidth(title) / 2), topLeftY + 11, + ScreenResources.TEXT_INPUT.draw(this, guiLeft, guiTop); + font.drawString(title, guiLeft + (sWidth / 2) - (font.getStringWidth(title) / 2), guiTop + 11, ScreenResources.FONT_COLOR); } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java index 6076adcd3..c4dbd77ee 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java @@ -14,12 +14,14 @@ public class ScrollInput extends AbstractSimiWidget { protected Label displayLabel; protected int min, max; + protected int shiftStep; public ScrollInput(int xIn, int yIn, int widthIn, int heightIn) { super(xIn, yIn, widthIn, heightIn); state = 0; min = 0; max = 1; + shiftStep = 5; } public ScrollInput withRange(int min, int max) { @@ -57,6 +59,11 @@ public class ScrollInput extends AbstractSimiWidget { writeToLabel(); return this; } + + public ScrollInput withShiftStep(int step) { + shiftStep = step; + return this; + } @Override public boolean mouseScrolled(double mouseX, double mouseY, double delta) { @@ -64,9 +71,12 @@ public class ScrollInput extends AbstractSimiWidget { return false; int priorState = state; - int step = (int) Math.signum(delta) * (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT) ? 5 : 1); - + boolean shifted = KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT); + int step = (int) Math.signum(delta) * (shifted ? shiftStep : 1); state += step; + if (shifted) + state -= state % shiftStep; + clampState(); if (priorState != state) @@ -82,7 +92,7 @@ public class ScrollInput extends AbstractSimiWidget { state = min; } - protected void onChanged() { + public void onChanged() { if (displayLabel != null) writeToLabel(); if (onScroll != null) @@ -97,143 +107,8 @@ public class ScrollInput extends AbstractSimiWidget { protected void updateTooltip() { toolTip.clear(); toolTip.add(TextFormatting.BLUE + title); + toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Scroll to Modify"); + toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Shift to Scroll faster"); } - -// public interface IScrollAction { -// public void onScroll(int position); -// } -// -// public interface ICancelableScrollAction extends IScrollAction { -// public void onScroll(int position); -// -// public boolean canScroll(int position); -// } -// -// private int x, y, width, height; -// private IScrollAction action; -// public boolean enabled; -// private Optional> tooltipContent; -// private int min, max; -// private boolean limitless; -// private boolean numeric; -// -// public ScrollArea(List options, IScrollAction action) { -// this(0, options.size(), action); -// this.tooltipContent = Optional.of(options); -// updateTooltip(); -// } -// -// public ScrollArea(int min, int max, IScrollAction action) { -// this(action); -// this.limitless = false; -// this.min = min; -// this.max = max; -// } -// -// public ScrollArea(IScrollAction action) { -// this.enabled = true; -// this.action = action; -// this.tooltipContent = Optional.absent(); -// this.limitless = true; -// this.numeric = false; -// } -// -// public void setBounds(int x, int y, int width, int height) { -// this.x = x; -// this.y = y; -// this.width = width; -// this.height = height; -// } -// -// public void setState(int state) { -// currentState = state; -// updateTooltip(); -// } -// -// public int getState() { -// return currentState; -// } -// -// public boolean isHovered(double x, double y) { -// return (x > this.x && x < this.x + this.width && y > this.y && y < this.y + this.height); -// } -// -// public void tryScroll(double mouseX, double mouseY, int amount) { -// if (enabled && isHovered(mouseX, mouseY)) { -// scroll(numeric? -amount : amount); -// } -// } -// -// public void setNumeric(boolean numeric) { -// this.numeric = numeric; -// } -// -// private void scroll(int amount) { -// if (enabled) { -// -// if (limitless) { -// if (!(action instanceof ICancelableScrollAction) -// || ((ICancelableScrollAction) action).canScroll(amount)) -// action.onScroll(amount); -// return; -// } -// -// if (!(action instanceof ICancelableScrollAction) -// || ((ICancelableScrollAction) action).canScroll(currentState + amount)) { -// currentState += amount; -// if (currentState < min) -// currentState = min; -// if (currentState >= max) -// currentState = max - 1; -// updateTooltip(); -// action.onScroll(currentState); -// } -// } -// } -// -// public void draw(Screen screen, int mouseX, int mouseY) { -// GlStateManager.pushLightingAttributes(); -// if (enabled && isHovered(mouseX, mouseY)) { -// GlStateManager.pushMatrix(); -// GlStateManager.translated(mouseX, mouseY,0); -// if (tooltipContent.isPresent()) -// screen.renderTooltip(getToolTip(), 0, 0); -// else -// screen.renderTooltip(TextFormatting.BLUE + title, 0, 0); -// GlStateManager.popMatrix(); -// } -// -// GlStateManager.popAttributes(); -// } -// -// public List getToolTip() { -// return tooltip; -// } -// -// public void setTitle(String title) { -// this.title = title; -// updateTooltip(); -// } -// -// private void updateTooltip() { -// tooltip = new LinkedList<>(); -// tooltip.add(TextFormatting.BLUE + title); -// -// if (tooltipContent.isPresent()) { -// for (int i = min; i < max; i++) { -// StringBuilder result = new StringBuilder(); -// if (i == currentState) -// result.append(TextFormatting.WHITE).append("-> ").append(tooltipContent.get().get(i)); -// else -// result.append(TextFormatting.GRAY).append("> ").append(tooltipContent.get().get(i)); -// tooltip.add(result.toString()); -// } -// -// } -// } -// -// public boolean isNumeric() { -// return numeric; -// } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java index 6a3a8f8c5..7106cae78 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java @@ -67,7 +67,7 @@ public class ItemDescription { public ItemDescription withBehaviour(String condition, String behaviour) { add(linesOnShift, GRAY + condition); - add(linesOnShift, cutString(behaviour, palette.hColor, 1)); + add(linesOnShift, cutString(behaviour, palette.color, 1)); return this; } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunScreen.java b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunScreen.java index d8e0de613..6c48b821c 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunScreen.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunScreen.java @@ -62,8 +62,8 @@ public class BuilderGunScreen extends AbstractSimiScreen { animationProgress = 0; setWindowSize(ScreenResources.PLACEMENT_GUN.width + 40, ScreenResources.PLACEMENT_GUN.height); super.init(); - int i = topLeftX - 20; - int j = topLeftY; + int i = guiLeft - 20; + int j = guiTop; CompoundNBT nbt = item.getOrCreateTag(); @@ -169,8 +169,8 @@ public class BuilderGunScreen extends AbstractSimiScreen { @Override protected void renderWindow(int mouseX, int mouseY, float partialTicks) { - int i = topLeftX - 20; - int j = topLeftY; + int i = guiLeft - 20; + int j = guiTop; ScreenResources.PLACEMENT_GUN.draw(this, i, j); font.drawStringWithShadow("Handheld Blockzapper", i + 8, j + 10, 0xCCDDFF); @@ -213,7 +213,7 @@ public class BuilderGunScreen extends AbstractSimiScreen { GlStateManager.pushMatrix(); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - GlStateManager.translated(topLeftX + 1.7f, topLeftY - 49, 120); + GlStateManager.translated(guiLeft + 1.7f, guiTop - 49, 120); GlStateManager.rotatef(-30f, .5f, .9f, -.1f); GlStateManager.scaled(20, -20, 20); diff --git a/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java b/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java index fef154227..481774351 100644 --- a/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java +++ b/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java @@ -172,14 +172,15 @@ public class TreeFertilizerItem extends InfoItem { } @Override - public MapData func_217406_a(String p_217406_1_) { - return wrapped.func_217406_a(p_217406_1_); + public MapData getMapData(String mapName) { + return wrapped.getMapData(mapName); } @Override - public void func_217399_a(MapData p_217399_1_) { + public void registerMapData(MapData mapDataIn) { + wrapped.registerMapData(mapDataIn); } - + @Override public int getNextMapId() { return 0; diff --git a/src/main/java/com/simibubi/create/modules/logistics/FlexCrateBlock.java b/src/main/java/com/simibubi/create/modules/logistics/FlexCrateBlock.java index 01dfad287..fba8e41a2 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/FlexCrateBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/FlexCrateBlock.java @@ -6,31 +6,80 @@ import com.simibubi.create.foundation.utility.ItemDescription.Palette; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.inventory.InventoryHelper; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; +import net.minecraftforge.fml.network.NetworkHooks; -public class FlexCrateBlock extends InfoBlock { +public class FlexcrateBlock extends InfoBlock { - public FlexCrateBlock() { + public static final VoxelShape SHAPE = makeCuboidShape(1, 0, 1, 15, 14, 15); + + public FlexcrateBlock() { super(Properties.from(Blocks.ANDESITE)); } @Override - public boolean hasTileEntity() { + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return SHAPE; + } + + @Override + public boolean hasTileEntity(BlockState state) { return true; } + @Override + public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, + BlockRayTraceResult hit) { + + if (worldIn.isRemote) { + return true; + } else { + FlexcrateTileEntity te = (FlexcrateTileEntity) worldIn.getTileEntity(pos); + if (te != null) + NetworkHooks.openGui((ServerPlayerEntity) player, te, te::sendToContainer); + return true; + } + } + @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new FlexCrateTileEntity(); + return new FlexcrateTileEntity(); } @Override public ItemDescription getDescription() { Palette color = Palette.Yellow; return new ItemDescription(color) - .withSummary("This Storage Container allows Manual control over its capacity. Can hold up to " - + h("16 Stacks", color) + " of Items."); + .withSummary("This Storage Container allows Manual control over its capacity. It can hold up to " + + h("16 Stacks", color) + " of Items.") + .createTabs(); + } + + @Override + public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { + if (worldIn.getTileEntity(pos) == null) + return; + + FlexcrateTileEntity te = (FlexcrateTileEntity) worldIn.getTileEntity(pos); + for (int slot = 0; slot < te.inventory.getSlots(); slot++) { + InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), + te.inventory.getStackInSlot(slot)); + } + + if (state.hasTileEntity() && state.getBlock() != newState.getBlock()) { + worldIn.removeTileEntity(pos); + } + } } diff --git a/src/main/java/com/simibubi/create/modules/logistics/FlexCrateContainer.java b/src/main/java/com/simibubi/create/modules/logistics/FlexCrateContainer.java index 75b811113..82c1ec111 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/FlexCrateContainer.java +++ b/src/main/java/com/simibubi/create/modules/logistics/FlexCrateContainer.java @@ -7,28 +7,68 @@ import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.Slot; +import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; +import net.minecraftforge.items.SlotItemHandler; -public class FlexCrateContainer extends Container { +public class FlexcrateContainer extends Container { - private FlexCrateTileEntity te; + public FlexcrateTileEntity te; + public PlayerInventory playerInventory; - public FlexCrateContainer(int id, PlayerInventory inv, PacketBuffer extraData) { - super(AllContainers.SchematicTable.type, id); + public FlexcrateContainer(int id, PlayerInventory inv, PacketBuffer extraData) { + super(AllContainers.FlexCrate.type, id); ClientWorld world = Minecraft.getInstance().world; - this.te = (FlexCrateTileEntity) world.getTileEntity(extraData.readBlockPos()); + this.te = (FlexcrateTileEntity) world.getTileEntity(extraData.readBlockPos()); this.te.handleUpdateTag(extraData.readCompoundTag()); + this.playerInventory = inv; init(); } - public FlexCrateContainer(int id, PlayerInventory inv, FlexCrateTileEntity te) { - super(AllContainers.SchematicTable.type, id); + public FlexcrateContainer(int id, PlayerInventory inv, FlexcrateTileEntity te) { + super(AllContainers.FlexCrate.type, id); this.te = te; + this.playerInventory = inv; init(); } private void init() { - + for (int row = 0; row < 4; ++row) { + for (int col = 0; col < 4; ++col) { + this.addSlot(new SlotItemHandler(te.inventory, col + row * 4, 124 + col * 18, 25 + row * 18)); + } + } + + // player Slots + int xOffset = 58; + int yOffset = 157; + for (int row = 0; row < 3; ++row) { + for (int col = 0; col < 9; ++col) { + this.addSlot(new Slot(playerInventory, col + row * 9 + 9, xOffset + col * 18, yOffset + row * 18)); + } + } + + for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot) { + this.addSlot(new Slot(playerInventory, hotbarSlot, xOffset + hotbarSlot * 18, yOffset + 58)); + } + + detectAndSendChanges(); + } + + @Override + public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { + Slot clickedSlot = getSlot(index); + if (!clickedSlot.getHasStack()) + return ItemStack.EMPTY; + + ItemStack stack = clickedSlot.getStack(); + if (index < 16) + mergeItemStack(stack, 16, inventorySlots.size(), false); + else + mergeItemStack(stack, 0, 15, false); + + return ItemStack.EMPTY; } @Override diff --git a/src/main/java/com/simibubi/create/modules/logistics/FlexCrateScreen.java b/src/main/java/com/simibubi/create/modules/logistics/FlexCrateScreen.java index fb1926ab3..cf2fb3ace 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/FlexCrateScreen.java +++ b/src/main/java/com/simibubi/create/modules/logistics/FlexCrateScreen.java @@ -1,19 +1,93 @@ package com.simibubi.create.modules.logistics; -import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; +import static com.simibubi.create.foundation.gui.ScreenResources.FLEXCRATE; +import static com.simibubi.create.foundation.gui.ScreenResources.PLAYER_INVENTORY; +import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; +import com.simibubi.create.foundation.gui.ScreenElementRenderer; +import com.simibubi.create.foundation.gui.ScreenResources; +import com.simibubi.create.foundation.gui.widgets.Label; +import com.simibubi.create.foundation.gui.widgets.ScrollInput; + +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.text.ITextComponent; -public class FlexCrateScreen extends AbstractSimiContainerScreen { +public class FlexcrateScreen extends AbstractSimiContainerScreen { - public FlexCrateScreen(FlexCrateContainer container, PlayerInventory inv, ITextComponent title) { + private FlexcrateTileEntity te; + private Label allowedItemsLabel; + private ScrollInput allowedItems; + private int lastModification; + + public FlexcrateScreen(FlexcrateContainer container, PlayerInventory inv, ITextComponent title) { super(container, inv, title); + te = container.te; + lastModification = -1; + } + + @Override + protected void init() { + setWindowSize(PLAYER_INVENTORY.width + 100, FLEXCRATE.height + PLAYER_INVENTORY.height + 20); + super.init(); + widgets.clear(); + + allowedItemsLabel = new Label(guiLeft + 100 + 70, guiTop + 107, "").colored(0xD3CBBE).withShadow(); + allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled("Storage Space") + .withRange(1, 1025).writingTo(allowedItemsLabel).withShiftStep(64).setState(te.allowedAmount) + .calling(s -> lastModification = 0); + allowedItems.onChanged(); + widgets.add(allowedItemsLabel); + widgets.add(allowedItems); } @Override protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + int crateLeft = guiLeft + 100; + int crateTop = guiTop; + int invLeft = guiLeft + 50; + int invTop = crateTop + FLEXCRATE.height + 10; + int hFontColor = 0xD3CBBE; + int fontColor = 0x4B3A22; + + FLEXCRATE.draw(this, crateLeft, crateTop); + font.drawStringWithShadow("FlexCrate", crateLeft - 3 + (FLEXCRATE.width - font.getStringWidth("FlexCrate")) / 2, + crateTop + 10, hFontColor); + String itemCount = "" + te.itemCount; + font.drawString(itemCount, crateLeft + 53 - font.getStringWidth(itemCount), crateTop + 107, fontColor); + + PLAYER_INVENTORY.draw(this, invLeft, invTop); + font.drawString("Inventory", invLeft + 7, invTop + 6, 0x666666); + + for (int slot = 0; slot < 16; slot++) { + if (allowedItems.getState() > slot * 64) + continue; + int x = crateLeft + 23 + (slot % 4) * 18; + int y = crateTop + 24 + (slot / 4) * 18; + ScreenResources.FLEXCRATE_LOCKED_SLOT.draw(this, x, y); + } + + ScreenElementRenderer.renderBlock(this::getRenderedBlock); + } + + @Override + public void tick() { + super.tick(); + if (lastModification >= 0) + lastModification++; + if (lastModification >= 15) { + lastModification = -1; + + } + } + + public BlockState getRenderedBlock() { + GlStateManager.translated(guiLeft + FLEXCRATE.width + 145, guiTop + 115, 0); + GlStateManager.rotatef(50, -.5f, 1, -.2f); + return AllBlocks.FLEXCRATE.get().getDefaultState(); } } diff --git a/src/main/java/com/simibubi/create/modules/logistics/FlexCrateTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/FlexCrateTileEntity.java index 68c957aa1..3adf6f527 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/FlexCrateTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/FlexCrateTileEntity.java @@ -7,18 +7,80 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.ItemStackHandler; -public class FlexCrateTileEntity extends SyncedTileEntity implements INamedContainerProvider { +public class FlexcrateTileEntity extends SyncedTileEntity implements INamedContainerProvider { - public FlexCrateTileEntity() { - super(AllTileEntities.FLEX_CRATE.type); + public class Inv extends ItemStackHandler { + public Inv() { + super(16); + } + + @Override + public int getSlotLimit(int slot) { + if (slot < allowedAmount / 64) + return super.getSlotLimit(slot); + else if (slot == allowedAmount / 64) + return allowedAmount % 64; + return 0; + } + + @Override + public boolean isItemValid(int slot, ItemStack stack) { + if (slot > allowedAmount / 64) + return false; + return super.isItemValid(slot, stack); + } + + @Override + protected void onContentsChanged(int slot) { + super.onContentsChanged(slot); + markDirty(); + } + } + + public Inv inventory; + public int allowedAmount; + public int itemCount; + + public FlexcrateTileEntity() { + this(AllTileEntities.FLEXCRATE.type); + } + + public FlexcrateTileEntity(TileEntityType type) { + super(type); + allowedAmount = 512; + itemCount = 10; + inventory = new Inv(); } @Override public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player) { - return new FlexCrateContainer(id, inventory, this); + return new FlexcrateContainer(id, inventory, this); + } + + @Override + public CompoundNBT write(CompoundNBT compound) { + compound.putInt("AllowedAmount", allowedAmount); + compound.put("Inventory", inventory.serializeNBT()); + return super.write(compound); + } + + @Override + public void read(CompoundNBT compound) { + allowedAmount = compound.getInt("AllowedAmount"); + inventory.deserializeNBT(compound.getCompound("Inventory")); + super.read(compound); } @Override @@ -26,4 +88,17 @@ public class FlexCrateTileEntity extends SyncedTileEntity implements INamedConta return new StringTextComponent(getType().getRegistryName().toString()); } + public void sendToContainer(PacketBuffer buffer) { + buffer.writeBlockPos(getPos()); + buffer.writeCompoundTag(getUpdateTag()); + } + + @Override + public LazyOptional getCapability(Capability capability, Direction facing) { + if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + return LazyOptional.of(() -> inventory).cast(); + } + return super.getCapability(capability, facing); + } + } diff --git a/src/main/java/com/simibubi/create/modules/logistics/FlexcrateBlock.java b/src/main/java/com/simibubi/create/modules/logistics/FlexcrateBlock.java new file mode 100644 index 000000000..fba8e41a2 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/FlexcrateBlock.java @@ -0,0 +1,85 @@ +package com.simibubi.create.modules.logistics; + +import com.simibubi.create.foundation.block.InfoBlock; +import com.simibubi.create.foundation.utility.ItemDescription; +import com.simibubi.create.foundation.utility.ItemDescription.Palette; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; +import net.minecraftforge.fml.network.NetworkHooks; + +public class FlexcrateBlock extends InfoBlock { + + public static final VoxelShape SHAPE = makeCuboidShape(1, 0, 1, 15, 14, 15); + + public FlexcrateBlock() { + super(Properties.from(Blocks.ANDESITE)); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return SHAPE; + } + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + @Override + public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, + BlockRayTraceResult hit) { + + if (worldIn.isRemote) { + return true; + } else { + FlexcrateTileEntity te = (FlexcrateTileEntity) worldIn.getTileEntity(pos); + if (te != null) + NetworkHooks.openGui((ServerPlayerEntity) player, te, te::sendToContainer); + return true; + } + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new FlexcrateTileEntity(); + } + + @Override + public ItemDescription getDescription() { + Palette color = Palette.Yellow; + return new ItemDescription(color) + .withSummary("This Storage Container allows Manual control over its capacity. It can hold up to " + + h("16 Stacks", color) + " of Items.") + .createTabs(); + } + + @Override + public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { + if (worldIn.getTileEntity(pos) == null) + return; + + FlexcrateTileEntity te = (FlexcrateTileEntity) worldIn.getTileEntity(pos); + for (int slot = 0; slot < te.inventory.getSlots(); slot++) { + InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), + te.inventory.getStackInSlot(slot)); + } + + if (state.hasTileEntity() && state.getBlock() != newState.getBlock()) { + worldIn.removeTileEntity(pos); + } + + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/FlexcrateContainer.java b/src/main/java/com/simibubi/create/modules/logistics/FlexcrateContainer.java new file mode 100644 index 000000000..82c1ec111 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/FlexcrateContainer.java @@ -0,0 +1,79 @@ +package com.simibubi.create.modules.logistics; + +import com.simibubi.create.AllContainers; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; +import net.minecraftforge.items.SlotItemHandler; + +public class FlexcrateContainer extends Container { + + public FlexcrateTileEntity te; + public PlayerInventory playerInventory; + + public FlexcrateContainer(int id, PlayerInventory inv, PacketBuffer extraData) { + super(AllContainers.FlexCrate.type, id); + ClientWorld world = Minecraft.getInstance().world; + this.te = (FlexcrateTileEntity) world.getTileEntity(extraData.readBlockPos()); + this.te.handleUpdateTag(extraData.readCompoundTag()); + this.playerInventory = inv; + init(); + } + + public FlexcrateContainer(int id, PlayerInventory inv, FlexcrateTileEntity te) { + super(AllContainers.FlexCrate.type, id); + this.te = te; + this.playerInventory = inv; + init(); + } + + private void init() { + for (int row = 0; row < 4; ++row) { + for (int col = 0; col < 4; ++col) { + this.addSlot(new SlotItemHandler(te.inventory, col + row * 4, 124 + col * 18, 25 + row * 18)); + } + } + + // player Slots + int xOffset = 58; + int yOffset = 157; + for (int row = 0; row < 3; ++row) { + for (int col = 0; col < 9; ++col) { + this.addSlot(new Slot(playerInventory, col + row * 9 + 9, xOffset + col * 18, yOffset + row * 18)); + } + } + + for (int hotbarSlot = 0; hotbarSlot < 9; ++hotbarSlot) { + this.addSlot(new Slot(playerInventory, hotbarSlot, xOffset + hotbarSlot * 18, yOffset + 58)); + } + + detectAndSendChanges(); + } + + @Override + public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { + Slot clickedSlot = getSlot(index); + if (!clickedSlot.getHasStack()) + return ItemStack.EMPTY; + + ItemStack stack = clickedSlot.getStack(); + if (index < 16) + mergeItemStack(stack, 16, inventorySlots.size(), false); + else + mergeItemStack(stack, 0, 15, false); + + return ItemStack.EMPTY; + } + + @Override + public boolean canInteractWith(PlayerEntity playerIn) { + return true; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/FlexcrateScreen.java b/src/main/java/com/simibubi/create/modules/logistics/FlexcrateScreen.java new file mode 100644 index 000000000..cf2fb3ace --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/FlexcrateScreen.java @@ -0,0 +1,93 @@ +package com.simibubi.create.modules.logistics; + +import static com.simibubi.create.foundation.gui.ScreenResources.FLEXCRATE; +import static com.simibubi.create.foundation.gui.ScreenResources.PLAYER_INVENTORY; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; +import com.simibubi.create.foundation.gui.ScreenElementRenderer; +import com.simibubi.create.foundation.gui.ScreenResources; +import com.simibubi.create.foundation.gui.widgets.Label; +import com.simibubi.create.foundation.gui.widgets.ScrollInput; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.util.text.ITextComponent; + +public class FlexcrateScreen extends AbstractSimiContainerScreen { + + private FlexcrateTileEntity te; + private Label allowedItemsLabel; + private ScrollInput allowedItems; + private int lastModification; + + public FlexcrateScreen(FlexcrateContainer container, PlayerInventory inv, ITextComponent title) { + super(container, inv, title); + te = container.te; + lastModification = -1; + } + + @Override + protected void init() { + setWindowSize(PLAYER_INVENTORY.width + 100, FLEXCRATE.height + PLAYER_INVENTORY.height + 20); + super.init(); + widgets.clear(); + + allowedItemsLabel = new Label(guiLeft + 100 + 70, guiTop + 107, "").colored(0xD3CBBE).withShadow(); + allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled("Storage Space") + .withRange(1, 1025).writingTo(allowedItemsLabel).withShiftStep(64).setState(te.allowedAmount) + .calling(s -> lastModification = 0); + allowedItems.onChanged(); + widgets.add(allowedItemsLabel); + widgets.add(allowedItems); + } + + @Override + protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + int crateLeft = guiLeft + 100; + int crateTop = guiTop; + int invLeft = guiLeft + 50; + int invTop = crateTop + FLEXCRATE.height + 10; + int hFontColor = 0xD3CBBE; + int fontColor = 0x4B3A22; + + FLEXCRATE.draw(this, crateLeft, crateTop); + font.drawStringWithShadow("FlexCrate", crateLeft - 3 + (FLEXCRATE.width - font.getStringWidth("FlexCrate")) / 2, + crateTop + 10, hFontColor); + String itemCount = "" + te.itemCount; + font.drawString(itemCount, crateLeft + 53 - font.getStringWidth(itemCount), crateTop + 107, fontColor); + + PLAYER_INVENTORY.draw(this, invLeft, invTop); + font.drawString("Inventory", invLeft + 7, invTop + 6, 0x666666); + + for (int slot = 0; slot < 16; slot++) { + if (allowedItems.getState() > slot * 64) + continue; + int x = crateLeft + 23 + (slot % 4) * 18; + int y = crateTop + 24 + (slot / 4) * 18; + ScreenResources.FLEXCRATE_LOCKED_SLOT.draw(this, x, y); + } + + ScreenElementRenderer.renderBlock(this::getRenderedBlock); + } + + @Override + public void tick() { + super.tick(); + if (lastModification >= 0) + lastModification++; + + if (lastModification >= 15) { + lastModification = -1; + + } + } + + public BlockState getRenderedBlock() { + GlStateManager.translated(guiLeft + FLEXCRATE.width + 145, guiTop + 115, 0); + GlStateManager.rotatef(50, -.5f, 1, -.2f); + return AllBlocks.FLEXCRATE.get().getDefaultState(); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/FlexcrateTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/FlexcrateTileEntity.java new file mode 100644 index 000000000..3adf6f527 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/FlexcrateTileEntity.java @@ -0,0 +1,104 @@ +package com.simibubi.create.modules.logistics; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.foundation.block.SyncedTileEntity; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.INamedContainerProvider; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.ItemStackHandler; + +public class FlexcrateTileEntity extends SyncedTileEntity implements INamedContainerProvider { + + public class Inv extends ItemStackHandler { + public Inv() { + super(16); + } + + @Override + public int getSlotLimit(int slot) { + if (slot < allowedAmount / 64) + return super.getSlotLimit(slot); + else if (slot == allowedAmount / 64) + return allowedAmount % 64; + return 0; + } + + @Override + public boolean isItemValid(int slot, ItemStack stack) { + if (slot > allowedAmount / 64) + return false; + return super.isItemValid(slot, stack); + } + + @Override + protected void onContentsChanged(int slot) { + super.onContentsChanged(slot); + markDirty(); + } + } + + public Inv inventory; + public int allowedAmount; + public int itemCount; + + public FlexcrateTileEntity() { + this(AllTileEntities.FLEXCRATE.type); + } + + public FlexcrateTileEntity(TileEntityType type) { + super(type); + allowedAmount = 512; + itemCount = 10; + inventory = new Inv(); + } + + @Override + public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player) { + return new FlexcrateContainer(id, inventory, this); + } + + @Override + public CompoundNBT write(CompoundNBT compound) { + compound.putInt("AllowedAmount", allowedAmount); + compound.put("Inventory", inventory.serializeNBT()); + return super.write(compound); + } + + @Override + public void read(CompoundNBT compound) { + allowedAmount = compound.getInt("AllowedAmount"); + inventory.deserializeNBT(compound.getCompound("Inventory")); + super.read(compound); + } + + @Override + public ITextComponent getDisplayName() { + return new StringTextComponent(getType().getRegistryName().toString()); + } + + public void sendToContainer(PacketBuffer buffer) { + buffer.writeBlockPos(getPos()); + buffer.writeCompoundTag(getUpdateTag()); + } + + @Override + public LazyOptional getCapability(Capability capability, Direction facing) { + if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + return LazyOptional.of(() -> inventory).cast(); + } + return super.getCapability(capability, facing); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeBlock.java b/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeBlock.java index f2e3e7774..801e27483 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeBlock.java @@ -1,17 +1,28 @@ package com.simibubi.create.modules.logistics; +import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.tuple.Pair; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.utility.ITooltip; import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.TooltipHolder; import com.simibubi.create.foundation.utility.ItemDescription.Palette; +import com.simibubi.create.foundation.utility.TessellatorHelper; +import com.simibubi.create.foundation.utility.TooltipHolder; +import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; @@ -20,37 +31,126 @@ import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.Hand; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; +import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +@EventBusSubscriber(value = Dist.CLIENT) public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITooltip { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; + public static final BooleanProperty RECEIVER = BooleanProperty.create("receiver"); + private static final List> itemPositions = new ArrayList<>(Direction.values().length); public static final VoxelShape UP_SHAPE = makeCuboidShape(2, 0, 2, 14, 3, 14), DOWN_SHAPE = makeCuboidShape(2, 13, 2, 14, 16, 14); - public static final VoxelShape SOUTH_SHAPE = makeCuboidShape(3, 1, -1, 13, 15, 2), - NORTH_SHAPE = makeCuboidShape(3, 1, 14, 13, 15, 17), EAST_SHAPE = makeCuboidShape(-1, 1, 3, 2, 15, 13), - WEST_SHAPE = makeCuboidShape(14, 1, 3, 17, 15, 13); + public static final VoxelShape + SOUTH_SHAPE = makeCuboidShape(3, 1, -1, 13, 15, 3), + NORTH_SHAPE = makeCuboidShape(3, 1, 13, 13, 15, 17), + EAST_SHAPE = makeCuboidShape(-1, 1, 3, 3, 15, 13), + WEST_SHAPE = makeCuboidShape(13, 1, 3, 17, 15, 13); private TooltipHolder info; public RedstoneBridgeBlock() { super(Properties.from(Blocks.DARK_OAK_LOG)); info = new TooltipHolder(this); + cacheItemPositions(); + setDefaultState(getDefaultState().with(POWERED, false).with(RECEIVER, false)); + } + + @Override + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, + boolean isMoving) { + Direction blockFacing = state.get(FACING); + + if (fromPos.equals(pos.offset(blockFacing.getOpposite()))) { + if (!isValidPosition(state, worldIn, pos)) { + worldIn.destroyBlock(pos, true); + return; + } + } + + if (worldIn.isRemote) + return; + if (state.get(RECEIVER)) + return; + + boolean previouslyPowered = state.get(POWERED); + if (previouslyPowered != worldIn.isBlockPowered(pos.offset(blockFacing.getOpposite()))) { + worldIn.setBlockState(pos, state.cycle(POWERED), 2); + + RedstoneBridgeTileEntity te = (RedstoneBridgeTileEntity) worldIn.getTileEntity(pos); + if (te == null) + return; + te.blockChanged(); + } + } + + @Override + public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, + BlockPos currentPos, BlockPos facingPos) { + boolean shouldPower = false; + Direction blockFacing = stateIn.get(FACING); + + if (worldIn.getWorld().isRemote) + return stateIn; + if (stateIn.get(RECEIVER)) + return stateIn; + + shouldPower = worldIn.getWorld().isBlockPowered(currentPos.offset(blockFacing.getOpposite())) + || worldIn.getWorld().isBlockPowered(currentPos); + if (stateIn.get(POWERED) != shouldPower) { + + RedstoneBridgeTileEntity te = (RedstoneBridgeTileEntity) worldIn.getTileEntity(currentPos); + if (te == null) + return stateIn; + te.blockChanged(); + + return stateIn.with(POWERED, shouldPower); + } + return stateIn; + } + + @Override + public boolean canProvidePower(BlockState state) { + return state.get(POWERED) && state.get(RECEIVER); + } + + @Override + public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) { + if (side != blockState.get(FACING)) + return 0; + return getWeakPower(blockState, blockAccess, pos, side); + } + + @Override + public int getWeakPower(BlockState state, IBlockReader blockAccess, BlockPos pos, Direction side) { + if (!state.get(RECEIVER)) + return 0; + return state.get(POWERED) ? 15 : 0; } @Override protected void fillStateContainer(Builder builder) { - builder.add(POWERED); + builder.add(POWERED, RECEIVER); super.fillStateContainer(builder); } @@ -64,6 +164,107 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITool return new RedstoneBridgeTileEntity(); } + @Override + public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, + BlockRayTraceResult hit) { + Direction facing = state.get(FACING); + Pair positions = itemPositions.get(facing.getIndex()); + ItemStack stack = player.getHeldItem(handIn); + RedstoneBridgeTileEntity te = (RedstoneBridgeTileEntity) worldIn.getTileEntity(pos); + + if (te == null) + return false; + + if (player.isSneaking()) { + if (!worldIn.isRemote) { + worldIn.setBlockState(pos, state.cycle(RECEIVER)); + te.blockChanged(); + } + return true; + } + + Vec3d vec = new Vec3d(pos); + Vec3d first = positions.getLeft().add(vec); + Vec3d second = positions.getRight().add(vec); + + if (new AxisAlignedBB(first, first).grow(2 / 16f).contains(hit.getHitVec())) { + if (worldIn.isRemote) + return true; + te.setFrequency(true, stack); + return true; + } + + if (new AxisAlignedBB(second, second).grow(2 / 16f).contains(hit.getHitVec())) { + if (worldIn.isRemote) + return true; + te.setFrequency(false, stack); + return true; + } + + return false; + } + + @SubscribeEvent + @OnlyIn(Dist.CLIENT) + public static void onDrawBlockHighlight(DrawBlockHighlightEvent event) { + if (event.getTarget() == null || !(event.getTarget() instanceof BlockRayTraceResult)) + return; + + BlockRayTraceResult result = (BlockRayTraceResult) event.getTarget(); + ClientWorld world = Minecraft.getInstance().world; + BlockPos pos = result.getPos(); + BlockState state = world.getBlockState(pos); + + if (!AllBlocks.REDSTONE_BRIDGE.typeOf(state)) + return; + + Direction facing = state.get(FACING); + Pair positions = itemPositions.get(facing.getIndex()); + RedstoneBridgeTileEntity te = (RedstoneBridgeTileEntity) world.getTileEntity(pos); + + if (te == null) + return; + + Vec3d vec = new Vec3d(pos); + Vec3d first = positions.getLeft().add(vec); + Vec3d second = positions.getRight().add(vec); + + AxisAlignedBB firstBB = new AxisAlignedBB(first, first).grow(2 / 16f); + AxisAlignedBB secondBB = new AxisAlignedBB(second, second).grow(2 / 16f); + + TessellatorHelper.prepareForDrawing(); + GlStateManager.enableBlend(); + GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); + GlStateManager.disableTexture(); + GlStateManager.depthMask(false); + GlStateManager.matrixMode(5889); + + if (firstBB.contains(result.getHitVec())) { + GlStateManager.lineWidth(2); + WorldRenderer.drawSelectionBoundingBox(firstBB.grow(1 / 128f), 1, 1, .5f, 1f); + } else { + GlStateManager.lineWidth(2); + WorldRenderer.drawSelectionBoundingBox(firstBB.grow(1 / 128f), .5f, .5f, .2f, 1f); + } + + if (secondBB.contains(result.getHitVec())) { + GlStateManager.lineWidth(2); + WorldRenderer.drawSelectionBoundingBox(secondBB.grow(1 / 128f), 1, 1, .5f, 1f); + } else { + GlStateManager.lineWidth(2); + WorldRenderer.drawSelectionBoundingBox(secondBB.grow(1 / 128f), .5f, .5f, .2f, 1f); + } + + GlStateManager.matrixMode(5888); + GlStateManager.depthMask(true); + GlStateManager.enableTexture(); + GlStateManager.disableBlend(); + GlStateManager.lineWidth(1); + TessellatorHelper.cleanUpAfterDrawing(); + } + @Override public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, Direction side) { return state.get(FACING) == Direction.UP; @@ -108,6 +309,47 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITool return VoxelShapes.empty(); } + private void cacheItemPositions() { + if (!itemPositions.isEmpty()) + return; + + Vec3d first = Vec3d.ZERO; + Vec3d second = Vec3d.ZERO; + Vec3d shift = VecHelper.getCenterOf(BlockPos.ZERO); + float zFightOffset = 1 / 128f; + + for (Direction facing : Direction.values()) { + if (facing.getAxis().isHorizontal()) { + first = new Vec3d(10 / 16f, 5.5f / 16f, 2f / 16f + zFightOffset); + second = new Vec3d(10 / 16f, 10.5f / 16f, 2f / 16f + zFightOffset); + + float angle = facing.getHorizontalAngle(); + if (facing.getAxis() == Axis.X) + angle = -angle; + + first = VecHelper.rotate(first.subtract(shift), angle, Axis.Y).add(shift); + second = VecHelper.rotate(second.subtract(shift), angle, Axis.Y).add(shift); + + } else { + first = new Vec3d(10 / 16f, 2f / 16f + zFightOffset, 5.5f / 16f); + second = new Vec3d(10 / 16f, 2f / 16f + zFightOffset, 10.5f / 16f); + + if (facing == Direction.DOWN) { + first = VecHelper.rotate(first.subtract(shift), 180, Axis.X).add(shift); + second = VecHelper.rotate(second.subtract(shift), 180, Axis.X).add(shift); + } + } + + itemPositions.add(Pair.of(first, second)); + } + + } + + public static Pair getFrequencyItemPositions(BlockState state) { + Direction facing = state.get(FACING); + return itemPositions.get(facing.getIndex()); + } + @Override @OnlyIn(value = Dist.CLIENT) public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, @@ -128,6 +370,8 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITool "Sets the " + h("Frequency", color) + " to that item. A total of " + h("two different items", color) + " can be used in combination for defining a Frequency.") + .withControl("When R-Clicked while Sneaking", + "Toggles between " + h("Receiver", color) + " and " + h("Transmitter", color) + " Mode. ") .createTabs(); } diff --git a/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeTileEntity.java index a61ead1ba..c2c032799 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeTileEntity.java @@ -1,6 +1,9 @@ package com.simibubi.create.modules.logistics; +import static net.minecraft.state.properties.BlockStateProperties.POWERED; + import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -12,8 +15,12 @@ import com.simibubi.create.foundation.block.SyncedTileEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.tileentity.ITickableTileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; -public class RedstoneBridgeTileEntity extends SyncedTileEntity { +public class RedstoneBridgeTileEntity extends SyncedTileEntity implements ITickableTileEntity { public static final int RANGE = 128; @@ -50,11 +57,15 @@ public class RedstoneBridgeTileEntity extends SyncedTileEntity { public Frequency frequencyFirst; public Frequency frequencyLast; + public boolean networkChanged; public RedstoneBridgeTileEntity() { super(AllTileEntities.REDSTONE_BRIDGE.type); frequencyFirst = new Frequency(ItemStack.EMPTY); frequencyLast = new Frequency(ItemStack.EMPTY); + + if (connections == null) + connections = new HashMap<>(); } @Override @@ -63,26 +74,97 @@ public class RedstoneBridgeTileEntity extends SyncedTileEntity { if (world.isRemote) return; - Pair networkKey = getNetworkKey(); - List TEs = connections.getOrDefault(networkKey, new ArrayList<>()); - TEs.add(this); - connections.put(networkKey, TEs); + addToNetwork(); } @Override public void remove() { super.remove(); + if (world.isRemote) + return; - Pair networkKey = getNetworkKey(); - List TEs = connections.get(networkKey); - if (TEs != null) - TEs.remove(this); + removeFromNetwork(); + } + + public void setFrequency(boolean first, ItemStack stack) { + stack = stack.copy(); + stack.setCount(1); + ItemStack toCompare = first ? frequencyFirst.stack : frequencyLast.stack; + boolean changed = !ItemStack.areItemsEqual(stack, toCompare) + || !ItemStack.areItemStackTagsEqual(stack, toCompare); + + if (changed) + removeFromNetwork(); + + if (first) + frequencyFirst = new Frequency(stack); + else + frequencyLast = new Frequency(stack); + + if (!changed) + return; + + world.notifyBlockUpdate(pos, getBlockState(), getBlockState(), 18); + addToNetwork(); } protected Pair getNetworkKey() { return Pair.of(frequencyFirst, frequencyLast); } + protected void addToNetwork() { + Pair networkKey = getNetworkKey(); + List TEs = connections.getOrDefault(networkKey, new ArrayList<>()); + TEs.add(this); + connections.put(networkKey, TEs); + notifyNetwork(); + } + + protected void removeFromNetwork() { + Pair networkKey = getNetworkKey(); + List TEs = connections.get(networkKey); + if (TEs != null) + TEs.remove(this); + if (TEs.isEmpty()) { + connections.remove(networkKey); + return; + } + notifyNetwork(); + } + + protected boolean isNetworkPowered() { + List TEs = connections.get(getNetworkKey()); + for (RedstoneBridgeTileEntity te : TEs) { + if (te == this) + continue; + if (te.canProvideNetworkPower()) + return true; + } + return false; + } + + protected void notifyNetwork() { + for (RedstoneBridgeTileEntity te : connections.get(getNetworkKey())) + te.networkChanged = true; + } + + public boolean canProvideNetworkPower() { + return isBlockPowered() && isTransmitter(); + } + + public boolean isTransmitter() { + return !getBlockState().get(RedstoneBridgeBlock.RECEIVER); + } + + public boolean isBlockPowered() { + return getBlockState().get(POWERED); + } + + public void blockChanged() { + notifyNetwork(); + networkChanged = true; + } + @Override public CompoundNBT write(CompoundNBT compound) { compound.put("FrequencyFirst", frequencyFirst.getStack().write(new CompoundNBT())); @@ -97,4 +179,21 @@ public class RedstoneBridgeTileEntity extends SyncedTileEntity { super.read(compound); } + @Override + public void tick() { + if (!networkChanged) + return; + networkChanged = false; + + if (isTransmitter()) + return; + if (isNetworkPowered() != isBlockPowered()) { + world.setBlockState(pos, getBlockState().cycle(POWERED)); + Direction attachedFace = getBlockState().get(BlockStateProperties.FACING).getOpposite(); + BlockPos attachedPos = pos.offset(attachedFace); + world.notifyNeighbors(attachedPos, world.getBlockState(attachedPos).getBlock()); + return; + } + } + } diff --git a/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeTileEntityRenderer.java new file mode 100644 index 000000000..91fb3ac7d --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/RedstoneBridgeTileEntityRenderer.java @@ -0,0 +1,79 @@ +package com.simibubi.create.modules.logistics; + +import org.apache.commons.lang3.tuple.Pair; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.foundation.utility.TessellatorHelper; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.item.ItemStack; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +@SuppressWarnings("deprecation") +public class RedstoneBridgeTileEntityRenderer extends TileEntityRenderer { + + @Override + public void render(RedstoneBridgeTileEntity tileEntityIn, double x, double y, double z, float partialTicks, + int destroyStage) { + super.render(tileEntityIn, x, y, z, partialTicks, destroyStage); + + Direction facing = tileEntityIn.getBlockState().get(BlockStateProperties.FACING); + + TessellatorHelper.prepareForDrawing(); + + Pair itemPositions = RedstoneBridgeBlock.getFrequencyItemPositions(tileEntityIn.getBlockState()); + Vec3d first = itemPositions.getLeft(); + Vec3d second = itemPositions.getRight(); + BlockPos pos = tileEntityIn.getPos(); + GlStateManager.translated(pos.getX(), pos.getY(), pos.getZ()); + + renderFrequencyItem(tileEntityIn.frequencyFirst.getStack(), first, facing); + renderFrequencyItem(tileEntityIn.frequencyLast.getStack(), second, facing); + + TessellatorHelper.cleanUpAfterDrawing(); + + } + + private void renderFrequencyItem(ItemStack stack, Vec3d position, Direction facing) { + ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); + boolean vertical = facing.getAxis().isVertical(); + + IBakedModel modelWithOverrides = itemRenderer.getModelWithOverrides(stack); + boolean blockItem = modelWithOverrides.isGui3d(); + + float offX = 0; + float offY = vertical && !blockItem ? 0 : 0; + float offZ = !blockItem ? 1/4f : 0; + if (vertical) + offZ = -offZ; + + float rotX = vertical ? 90 : 0; + float rotY = vertical ? 0 : facing.getHorizontalAngle() + (blockItem ? 180 : 0); + float rotZ = vertical && facing == Direction.DOWN ? 180 : 0; + if (facing.getAxis() == Axis.X) { +// offZ = -offZ; + rotY = -rotY; + } + + float scale = !blockItem ? .25f : .5f; + + GlStateManager.pushMatrix(); + GlStateManager.translated(position.x, position.y, position.z); + GlStateManager.scaled(scale, scale, scale); + GlStateManager.rotatef(rotZ, 0, 0, 1); + GlStateManager.rotatef(rotY, 0, 1, 0); + GlStateManager.rotatef(rotX, 1, 0, 0); + GlStateManager.translatef(offX, offY, offZ); + itemRenderer.renderItem(stack, TransformType.FIXED); + GlStateManager.popMatrix(); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchBlock.java deleted file mode 100644 index 5e26c668e..000000000 --- a/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchBlock.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.simibubi.create.modules.logistics; - -import java.util.List; - -import com.simibubi.create.foundation.block.ProperDirectionalBlock; -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; -import com.simibubi.create.foundation.utility.TooltipHolder; - -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.world.IBlockReader; - -public class StockpileSwitchBlock extends ProperDirectionalBlock implements ITooltip { - - private TooltipHolder info; - - public StockpileSwitchBlock() { - super(Properties.from(Blocks.ANDESITE)); - info = new TooltipHolder(this); - } - - @Override - public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, - ITooltipFlag flagIn) { - info.addInformation(tooltip); - } - - @Override - public boolean hasTileEntity() { - return true; - } - - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new StockpileSwitchTileEntity(); - } - - @Override - public ItemDescription getDescription() { - Palette color = Palette.Yellow; - return new ItemDescription(color) - .withSummary("Toggles a Redstone signal based on the " + h("Storage Space", color) - + " in the attached Container.") - .withBehaviour("When below Lower Limit", "Stops providing " + h("Redstone Power", color)) - .withBehaviour("When above Upper Limit", - "Starts providing " + h("Redstone Power", color) + " until Lower Limit is reached again.") - .withControl("When R-Clicked", "Opens the " + h("Configuration Screen", color)).createTabs(); - } - -} diff --git a/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchScreen.java b/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchScreen.java deleted file mode 100644 index af70c616a..000000000 --- a/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchScreen.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.simibubi.create.modules.logistics; - -public class StockpileSwitchScreen { - -} diff --git a/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchTileEntity.java deleted file mode 100644 index 078e6f287..000000000 --- a/src/main/java/com/simibubi/create/modules/logistics/StockpileSwitchTileEntity.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.simibubi.create.modules.logistics; - -import com.simibubi.create.AllTileEntities; -import com.simibubi.create.foundation.block.SyncedTileEntity; - -import net.minecraft.nbt.CompoundNBT; - -public class StockpileSwitchTileEntity extends SyncedTileEntity { - - private float offWhenAbove; - private float onWhenBelow; -// private float currentLevel; - - public StockpileSwitchTileEntity() { - super(AllTileEntities.STOCKPILE_SWITCH.type); - } - - @Override - public void read(CompoundNBT compound) { - - offWhenAbove = compound.getFloat("OffAbove"); - onWhenBelow = compound.getFloat("OnBelow"); - updateCurrentLevel(); - - super.read(compound); - } - - @Override - public CompoundNBT write(CompoundNBT compound) { - - compound.putFloat("OffAbove", offWhenAbove); - compound.putFloat("OnBelow", onWhenBelow); - - return super.write(compound); - } - - private void updateCurrentLevel() { - - } - -} diff --git a/src/main/java/com/simibubi/create/modules/logistics/StockswitchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/StockswitchBlock.java new file mode 100644 index 000000000..3acabde18 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/StockswitchBlock.java @@ -0,0 +1,108 @@ +package com.simibubi.create.modules.logistics; + +import java.util.List; + +import com.simibubi.create.foundation.gui.ScreenOpener; +import com.simibubi.create.foundation.utility.ITooltip; +import com.simibubi.create.foundation.utility.ItemDescription; +import com.simibubi.create.foundation.utility.ItemDescription.Palette; +import com.simibubi.create.foundation.utility.TooltipHolder; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.HorizontalBlock; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemStack; +import net.minecraft.state.IntegerProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.DistExecutor; + +public class StockswitchBlock extends HorizontalBlock implements ITooltip { + + public static final IntegerProperty INDICATOR = IntegerProperty.create("indicator", 0, 6); + private TooltipHolder info; + + public StockswitchBlock() { + super(Properties.from(Blocks.ANDESITE)); + info = new TooltipHolder(this); + } + + @Override + public boolean isSolid(BlockState state) { + return false; + } + + @Override + public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, + ITooltipFlag flagIn) { + info.addInformation(tooltip); + } + + @Override + protected void fillStateContainer(Builder builder) { + builder.add(HORIZONTAL_FACING, INDICATOR); + super.fillStateContainer(builder); + } + + @Override + public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, + BlockRayTraceResult hit) { + DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { + displayScreen((StockswitchTileEntity) worldIn.getTileEntity(pos)); + }); + return true; + } + + @OnlyIn(value = Dist.CLIENT) + protected void displayScreen(StockswitchTileEntity te) { + ScreenOpener.open(new StockswitchScreen(te)); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + BlockState state = getDefaultState(); + + if (context.getFace().getAxis().isHorizontal()) { + state = state.with(HORIZONTAL_FACING, context.getFace().getOpposite()); + } else { + state = state.with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing()); + } + + return state; + } + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new StockswitchTileEntity(); + } + + @Override + public ItemDescription getDescription() { + Palette color = Palette.Yellow; + return new ItemDescription(color) + .withSummary("Toggles a Redstone signal based on the " + h("Storage Space", color) + + " in the attached Container.") + .withBehaviour("When below Lower Limit", "Stops providing " + h("Redstone Power", color)) + .withBehaviour("When above Upper Limit", + "Starts providing " + h("Redstone Power", color) + " until Lower Limit is reached again.") + .withControl("When R-Clicked", "Opens the " + h("Configuration Screen", color)).createTabs(); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/StockswitchScreen.java b/src/main/java/com/simibubi/create/modules/logistics/StockswitchScreen.java new file mode 100644 index 000000000..9df29f301 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/StockswitchScreen.java @@ -0,0 +1,104 @@ +package com.simibubi.create.modules.logistics; + +import static com.simibubi.create.foundation.gui.ScreenResources.STOCKSWITCH; + +import java.util.Arrays; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.foundation.gui.AbstractSimiScreen; +import com.simibubi.create.foundation.gui.ScreenElementRenderer; +import com.simibubi.create.foundation.gui.ScreenResources; +import com.simibubi.create.foundation.gui.widgets.Label; +import com.simibubi.create.foundation.gui.widgets.ScrollInput; + +import net.minecraft.block.BlockState; + +public class StockswitchScreen extends AbstractSimiScreen { + + private ScrollInput offBelow; + private Label offBelowLabel; + private ScrollInput onAbove; + private Label onAboveLabel; + + private StockswitchTileEntity te; + + public StockswitchScreen(StockswitchTileEntity te) { + this.te = te; + } + + @Override + protected void init() { + setWindowSize(STOCKSWITCH.width + 50, STOCKSWITCH.height); + super.init(); + widgets.clear(); + + offBelowLabel = new Label(guiLeft + 116, guiTop + 72, "").colored(0xD3CBBE).withShadow(); + offBelow = new ScrollInput(guiLeft + 113, guiTop + 69, 33, 14).withRange(0, 96).titled("Lower Threshold") + .calling(state -> { + offBelowLabel.text = state + "%"; + if (onAbove.getState() - 4 <= state) { + onAbove.setState(state + 5); + onAbove.onChanged(); + } + }).setState((int) (te.offWhenBelow * 100)); + + onAboveLabel = new Label(guiLeft + 116, guiTop + 55, "").colored(0xD3CBBE).withShadow(); + onAbove = new ScrollInput(guiLeft + 113, guiTop + 52, 33, 14).withRange(5, 101).titled("Upper Threshold") + .calling(state -> { + onAboveLabel.text = state + "%"; + if (offBelow.getState() + 4 >= state) { + offBelow.setState(state - 5); + offBelow.onChanged(); + } + }).setState((int) (te.onWhenAbove * 100)); + + onAbove.onChanged(); + offBelow.onChanged(); + widgets.addAll(Arrays.asList(offBelowLabel, offBelow, onAbove, onAboveLabel)); + } + + @Override + protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + int hFontColor = 0xD3CBBE; + int fontColor = 0x4B3A22; + STOCKSWITCH.draw(this, guiLeft, guiTop); + font.drawStringWithShadow("Stockpile Switch", + guiLeft - 3 + (STOCKSWITCH.width - font.getStringWidth("Stockpile Switch")) / 2, guiTop + 10, + hFontColor); + font.drawString("Start Signal " + (onAbove.getState() == 100 ? "at" : "above"), guiLeft + 13, guiTop + 55, + fontColor); + font.drawString("Stop Signal " + (offBelow.getState() == 0 ? "at" : "below"), guiLeft + 13, guiTop + 72, + fontColor); + + ScreenResources sprite = ScreenResources.STOCKSWITCH_INTERVAL; + float lowerBound = offBelow.getState() / 100f * (sprite.width - 20) + 10; + float upperBound = onAbove.getState() / 100f * (sprite.width - 20) + 10; + float cursorPos = te.currentLevel * (sprite.width - 20) + 10; + + sprite.bind(); + blit((int) (guiLeft + lowerBound), guiTop + 26, (int) (sprite.startX + lowerBound), sprite.startY, + (int) (upperBound - lowerBound), sprite.height); + + sprite = ScreenResources.STOCKSWITCH_INTERVAL_END; + sprite.bind(); + blit((int) (guiLeft + upperBound), guiTop + 26, (int) (sprite.startX + upperBound), sprite.startY, + (int) (sprite.width - upperBound), sprite.height); + + ScreenResources.STOCKSWITCH_BOUND_LEFT.draw(this, (int) (guiLeft + lowerBound) - 1, guiTop + 24); + ScreenResources.STOCKSWITCH_BOUND_RIGHT.draw(this, (int) (guiLeft + upperBound) - 5, guiTop + 24); + + ScreenResources cursor = te.getWorld().isBlockPowered(te.getPos()) ? ScreenResources.STOCKSWITCH_CURSOR_ON + : ScreenResources.STOCKSWITCH_CURSOR_OFF; + cursor.draw(this, (int) (guiLeft + cursorPos), guiTop + 24); + + ScreenElementRenderer.renderBlock(this::getRenderedBlock); + } + + public BlockState getRenderedBlock() { + GlStateManager.translated(guiLeft + STOCKSWITCH.width + 50, guiTop + 100, 0); + GlStateManager.rotatef(50, -.5f, 1, -.2f); + return AllBlocks.STOCKSWITCH.get().getDefaultState(); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/StockswitchTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/StockswitchTileEntity.java new file mode 100644 index 000000000..da3bd7f31 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/StockswitchTileEntity.java @@ -0,0 +1,48 @@ +package com.simibubi.create.modules.logistics; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.foundation.block.SyncedTileEntity; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntityType; + +public class StockswitchTileEntity extends SyncedTileEntity { + + float onWhenAbove; + float offWhenBelow; + float currentLevel; + + public StockswitchTileEntity() { + this(AllTileEntities.STOCKSWITCH.type); + } + + public StockswitchTileEntity(TileEntityType typeIn) { + super(typeIn); + onWhenAbove = .75f; + offWhenBelow = .25f; + } + + @Override + public void read(CompoundNBT compound) { + + onWhenAbove = compound.getFloat("OnAbove"); + offWhenBelow = compound.getFloat("OffBelow"); + updateCurrentLevel(); + + super.read(compound); + } + + @Override + public CompoundNBT write(CompoundNBT compound) { + + compound.putFloat("OnAbove", onWhenAbove); + compound.putFloat("OffBelow", offWhenBelow); + + return super.write(compound); + } + + private void updateCurrentLevel() { + + } + +} diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java index 7cc1578b2..0186be7d3 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java @@ -1,5 +1,8 @@ package com.simibubi.create.modules.schematics.block; +import static com.simibubi.create.foundation.gui.ScreenResources.SCHEMATIC_TABLE; +import static com.simibubi.create.foundation.gui.ScreenResources.SCHEMATIC_TABLE_PROGRESS; + import java.nio.file.Paths; import java.util.List; @@ -42,10 +45,10 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen availableSchematics = Create.cSchematicLoader.getAvailableSchematics(); widgets.remove(schematicsArea); - + if (!availableSchematics.isEmpty()) { - schematicsArea = new SelectionScrollInput(guiLeft - 56 + 33, guiTop - 16 + 23, 134, 14).forOptions(availableSchematics) - .titled("Available Schematics").writingTo(schematicsLabel); + schematicsArea = new SelectionScrollInput(guiLeft - 56 + 33, guiTop - 16 + 23, 134, 14) + .forOptions(availableSchematics).titled("Available Schematics").writingTo(schematicsLabel); widgets.add(schematicsArea); } else { schematicsArea = null; diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java index 26b0d7305..57e02a9ac 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java @@ -96,7 +96,7 @@ public class SchematicannonBlock extends InfoBlock { public ItemDescription getDescription() { Palette color = Palette.Blue; return new ItemDescription(color).withSummary("Prints a deployed " + h("Schematic", color) - + "into the world using blocks from inventories placed right next to it."); + + " into the world using blocks from inventories placed right next to it.").createTabs(); } } diff --git a/src/main/java/com/simibubi/create/modules/schematics/client/BlueprintEditScreen.java b/src/main/java/com/simibubi/create/modules/schematics/client/BlueprintEditScreen.java index afa15ad81..8babee2da 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/client/BlueprintEditScreen.java +++ b/src/main/java/com/simibubi/create/modules/schematics/client/BlueprintEditScreen.java @@ -34,8 +34,8 @@ public class BlueprintEditScreen extends AbstractSimiScreen { @Override protected void init() { setWindowSize(ScreenResources.SCHEMATIC.width + 50, ScreenResources.SCHEMATIC.height); - int x = topLeftX; - int y = topLeftY; + int x = guiLeft; + int y = guiTop; BlueprintHandler bh = BlueprintHandler.instance; xInput = new TextFieldWidget(font, x + 75, y + 32, 32, 10, ""); @@ -117,8 +117,8 @@ public class BlueprintEditScreen extends AbstractSimiScreen { @Override protected void renderWindow(int mouseX, int mouseY, float partialTicks) { - int x = topLeftX; - int y = topLeftY; + int x = guiLeft; + int y = guiTop; ScreenResources.SCHEMATIC.draw(this, x, y); BlueprintHandler bh = BlueprintHandler.instance; @@ -130,7 +130,7 @@ public class BlueprintEditScreen extends AbstractSimiScreen { font.drawString("Mirror", x + 10, y + 72, ScreenResources.FONT_COLOR); GlStateManager.pushMatrix(); - GlStateManager.translated(topLeftX + 220, topLeftY + 20, 0); + GlStateManager.translated(guiLeft + 220, guiTop + 20, 0); GlStateManager.scaled(3, 3, 3); itemRenderer.renderItemIntoGUI(new ItemStack(AllItems.BLUEPRINT.get()), 0, 0); GlStateManager.popMatrix(); diff --git a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandScreen.java b/src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandScreen.java index 23755ecea..f0888923a 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandScreen.java +++ b/src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandScreen.java @@ -56,12 +56,12 @@ public class SymmetryWandScreen extends AbstractSimiScreen { super.init(); this.setWindowSize(ScreenResources.WAND_SYMMETRY.width + 50, ScreenResources.WAND_SYMMETRY.height + 50); - labelType = new Label(topLeftX + 122, topLeftY + 15, "").colored(0xFFFFFFFF).withShadow(); - labelAlign = new Label(topLeftX + 122, topLeftY + 35, "").colored(0xFFFFFFFF).withShadow(); + labelType = new Label(guiLeft + 122, guiTop + 15, "").colored(0xFFFFFFFF).withShadow(); + labelAlign = new Label(guiLeft + 122, guiTop + 35, "").colored(0xFFFFFFFF).withShadow(); int state = currentElement instanceof TriplePlaneMirror ? 2 : currentElement instanceof CrossPlaneMirror ? 1 : 0; - areaType = new SelectionScrollInput(topLeftX + 119, topLeftY + 12, 70, 14) + areaType = new SelectionScrollInput(guiLeft + 119, guiTop + 12, 70, 14) .forOptions(SymmetryMirror.TOOLTIP_ELEMENTS).titled("Type of Mirror").writingTo(labelType) .setState(state); @@ -97,7 +97,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen { widgets.remove(areaAlign); } - areaAlign = new SelectionScrollInput(topLeftX + 119, topLeftY + 32, 70, 14).forOptions(element.getAlignToolTips()) + areaAlign = new SelectionScrollInput(guiLeft + 119, guiTop + 32, 70, 14).forOptions(element.getAlignToolTips()) .titled("Direction").writingTo(labelAlign).setState(element.getOrientationIndex()) .calling(element::setOrientation); @@ -112,10 +112,10 @@ public class SymmetryWandScreen extends AbstractSimiScreen { @Override protected void renderWindow(int mouseX, int mouseY, float partialTicks) { - ScreenResources.WAND_SYMMETRY.draw(this, topLeftX, topLeftY); + ScreenResources.WAND_SYMMETRY.draw(this, guiLeft, guiTop); - int x = topLeftX + 63; - int y = topLeftY + 15; + int x = guiLeft + 63; + int y = guiTop + 15; font.drawString("Symmetry", x, y, ScreenResources.FONT_COLOR); font.drawString("Direction", x, y + 20, ScreenResources.FONT_COLOR); @@ -155,7 +155,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen { GlStateManager.pushMatrix(); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - GlStateManager.translated(topLeftX + 15, topLeftY - 117, 20); + GlStateManager.translated(guiLeft + 15, guiTop - 117, 20); GlStateManager.rotatef(-22.5f, .3f, 1f, 0f); GlStateManager.scaled(32, -32, 32); minecraft.getBlockRendererDispatcher().renderBlock(currentElement.getModel(), new BlockPos(0, -5, 0), diff --git a/src/main/resources/assets/create/blockstates/flexcrate.json b/src/main/resources/assets/create/blockstates/flexcrate.json new file mode 100644 index 000000000..6dfa15028 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/flexcrate.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "create:block/flex_crate" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/redstone_bridge.json b/src/main/resources/assets/create/blockstates/redstone_bridge.json index bdc988d68..08162ed76 100644 --- a/src/main/resources/assets/create/blockstates/redstone_bridge.json +++ b/src/main/resources/assets/create/blockstates/redstone_bridge.json @@ -1,17 +1,31 @@ { "variants": { - "powered=false,facing=up": { "model": "create:block/redstone_bridge" }, - "powered=false,facing=down": { "model": "create:block/redstone_bridge", "x": 180 }, - "powered=false,facing=south": { "model": "create:block/redstone_bridge_side"}, - "powered=false,facing=north": { "model": "create:block/redstone_bridge_side", "y": 180 }, - "powered=false,facing=west": { "model": "create:block/redstone_bridge_side", "y": 90 }, - "powered=false,facing=east": { "model": "create:block/redstone_bridge_side", "y": 270 }, + "receiver=false,powered=false,facing=up": { "model": "create:block/redstone_bridge", "y": 180 }, + "receiver=false,powered=false,facing=down": { "model": "create:block/redstone_bridge", "x": 180, "y": 180 }, + "receiver=false,powered=false,facing=south": { "model": "create:block/redstone_bridge_side", "x": 270 }, + "receiver=false,powered=false,facing=north": { "model": "create:block/redstone_bridge_side", "x": 270 , "y": 180 }, + "receiver=false,powered=false,facing=west": { "model": "create:block/redstone_bridge_side", "x": 270 , "y": 90 }, + "receiver=false,powered=false,facing=east": { "model": "create:block/redstone_bridge_side", "x": 270 , "y": 270 }, - "powered=true,facing=up": { "model": "create:block/redstone_bridge_powered" }, - "powered=true,facing=down": { "model": "create:block/redstone_bridge_powered", "x": 180 }, - "powered=true,facing=south": { "model": "create:block/redstone_bridge_side_powered"}, - "powered=true,facing=north": { "model": "create:block/redstone_bridge_side_powered", "y": 180 }, - "powered=true,facing=west": { "model": "create:block/redstone_bridge_side_powered", "y": 90 }, - "powered=true,facing=east": { "model": "create:block/redstone_bridge_side_powered", "y": 270 } + "receiver=false,powered=true,facing=up": { "model": "create:block/redstone_bridge_powered", "y": 180 }, + "receiver=false,powered=true,facing=down": { "model": "create:block/redstone_bridge_powered", "x": 180, "y": 180 }, + "receiver=false,powered=true,facing=south": { "model": "create:block/redstone_bridge_side_powered", "x": 270 }, + "receiver=false,powered=true,facing=north": { "model": "create:block/redstone_bridge_side_powered", "x": 270 , "y": 180 }, + "receiver=false,powered=true,facing=west": { "model": "create:block/redstone_bridge_side_powered", "x": 270 , "y": 90 }, + "receiver=false,powered=true,facing=east": { "model": "create:block/redstone_bridge_side_powered", "x": 270 , "y": 270 }, + + "receiver=true,powered=false,facing=up": { "model": "create:block/redstone_bridge_receiver", "y": 180 }, + "receiver=true,powered=false,facing=down": { "model": "create:block/redstone_bridge_receiver", "x": 180, "y": 180 }, + "receiver=true,powered=false,facing=south": { "model": "create:block/redstone_bridge_receiver_side", "x": 270 }, + "receiver=true,powered=false,facing=north": { "model": "create:block/redstone_bridge_receiver_side", "x": 270 , "y": 180 }, + "receiver=true,powered=false,facing=west": { "model": "create:block/redstone_bridge_receiver_side", "x": 270 , "y": 90 }, + "receiver=true,powered=false,facing=east": { "model": "create:block/redstone_bridge_receiver_side", "x": 270 , "y": 270 }, + + "receiver=true,powered=true,facing=up": { "model": "create:block/redstone_bridge_receiver_powered", "y": 180 }, + "receiver=true,powered=true,facing=down": { "model": "create:block/redstone_bridge_receiver_powered", "x": 180, "y": 180 }, + "receiver=true,powered=true,facing=south": { "model": "create:block/redstone_bridge_receiver_side_powered", "x": 270 }, + "receiver=true,powered=true,facing=north": { "model": "create:block/redstone_bridge_receiver_side_powered", "x": 270 , "y": 180 }, + "receiver=true,powered=true,facing=west": { "model": "create:block/redstone_bridge_receiver_side_powered", "x": 270 , "y": 90 }, + "receiver=true,powered=true,facing=east": { "model": "create:block/redstone_bridge_receiver_side_powered", "x": 270 , "y": 270 } } } \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/stockswitch.json b/src/main/resources/assets/create/blockstates/stockswitch.json new file mode 100644 index 000000000..15107fc1e --- /dev/null +++ b/src/main/resources/assets/create/blockstates/stockswitch.json @@ -0,0 +1,23 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "create:block/stockpile_switch" + }, + "variants": { + "indicator": { + "0": { "model": "create:block/stockpile_switch" }, + "1": { "model": "create:block/stockpile_switch_1" }, + "2": { "model": "create:block/stockpile_switch_2" }, + "3": { "model": "create:block/stockpile_switch_3" }, + "4": { "model": "create:block/stockpile_switch_4" }, + "5": { "model": "create:block/stockpile_switch_5" }, + "6": { "model": "create:block/stockpile_switch_6" } + }, + "facing": { + "south": { "y": 270 }, + "east": { "y": 180 }, + "north": { "y": 90 }, + "west": { "y": 0 } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index 1ddc79efd..2b82309cf 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -35,8 +35,8 @@ "block.create.contact": "Redstone Contact", "block.create.redstone_bridge": "Redstone Bridge", - "block.create.stockpile_switch": "Stockpile Switch", - "block.create.flex_crate": "FlexCrate", + "block.create.stockswitch": "Stockpile Switch", + "block.create.flexcrate": "FlexCrate", "block.create.andesite_bricks": "Andesite Bricks", "block.create.diorite_bricks": "Diorite Bricks", diff --git a/src/main/resources/assets/create/models/block/flex_crate.json b/src/main/resources/assets/create/models/block/flex_crate.json new file mode 100644 index 000000000..c3d00528a --- /dev/null +++ b/src/main/resources/assets/create/models/block/flex_crate.json @@ -0,0 +1,22 @@ +{ + "parent": "block/block", + "textures": { + "particle": "create:block/flex_crate", + "flex_crate": "create:block/flex_crate" + }, + "elements": [ + { + "name": "Crate", + "from": [ 1, 0, 1 ], + "to": [ 15, 14, 15 ], + "faces": { + "north": { "texture": "#flex_crate", "uv": [ 1, 1, 15, 15 ] }, + "east": { "texture": "#flex_crate", "uv": [ 1, 1, 15, 15 ] }, + "south": { "texture": "#flex_crate", "uv": [ 1, 1, 15, 15 ] }, + "west": { "texture": "#flex_crate", "uv": [ 1, 1, 15, 15 ] }, + "up": { "texture": "#flex_crate", "uv": [ 1, 1, 15, 15 ] }, + "down": { "texture": "#flex_crate", "uv": [ 1, 1, 15, 15 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/redstone_bridge.json b/src/main/resources/assets/create/models/block/redstone_bridge.json index b06bd3eb6..3463ac2fe 100644 --- a/src/main/resources/assets/create/models/block/redstone_bridge.json +++ b/src/main/resources/assets/create/models/block/redstone_bridge.json @@ -11,7 +11,7 @@ "textures": { "redstone_antenna": "create:block/redstone_antenna", "redstone_bridge": "create:block/redstone_bridge", - "particle": "#redstone_bridge" + "particle": "create:block/redstone_bridge" }, "elements": [ { diff --git a/src/main/resources/assets/create/models/block/redstone_bridge_powered.json b/src/main/resources/assets/create/models/block/redstone_bridge_powered.json index 9365eb044..20e8b9390 100644 --- a/src/main/resources/assets/create/models/block/redstone_bridge_powered.json +++ b/src/main/resources/assets/create/models/block/redstone_bridge_powered.json @@ -2,6 +2,7 @@ "parent": "create:block/redstone_bridge", "textures": { "redstone_antenna": "create:block/redstone_antenna_powered", - "redstone_bridge": "create:block/redstone_bridge_powered" + "redstone_bridge": "create:block/redstone_bridge_powered", + "particle": "create:block/redstone_bridge_powered" } } \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/redstone_bridge_receiver.json b/src/main/resources/assets/create/models/block/redstone_bridge_receiver.json new file mode 100644 index 000000000..d4a811669 --- /dev/null +++ b/src/main/resources/assets/create/models/block/redstone_bridge_receiver.json @@ -0,0 +1,66 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)", + "parent": "block/block", + "display": { + "gui": { + "rotation": [ 30, 45, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.625, 0.625, 0.625 ] + } + }, + "textures": { + "redstone_antenna": "create:block/redstone_antenna", + "redstone_bridge": "create:block/redstone_bridge", + "particle": "create:block/redstone_bridge" + }, + "elements": [ + { + "name": "Controller", + "from": [ 2, 0, 2 ], + "to": [ 14, 3, 14 ], + "faces": { + "north": { "texture": "#redstone_bridge", "uv": [ 12, 0, 15, 12 ], "rotation": 90 }, + "east": { "texture": "#redstone_bridge", "uv": [ 0, 12, 12, 15 ] }, + "south": { "texture": "#redstone_bridge", "uv": [ 12, 0, 15, 12 ], "rotation": 90 }, + "west": { "texture": "#redstone_bridge", "uv": [ 0, 12, 12, 15 ] }, + "up": { "texture": "#redstone_bridge", "uv": [ 0, 0, 12, 12 ], "rotation": 270 } + } + }, + { + "name": "AntennaX", + "from": [ 0, 1, 4 ], + "to": [ 3, 11, 5 ], + "faces": { + "north": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }, + "south": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }, + "down": { "texture": "#redstone_antenna", "uv": [ 0, 9, 3, 10 ] } + } + }, + { + "name": "AntennaZ", + "from": [ 1, 1, 3 ], + "to": [ 2, 11, 6 ], + "faces": { + "east": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }, + "west": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] } + } + }, + { + "name": "AntennaTop", + "from": [ 1, 9, 4 ], + "to": [ 2, 10, 5 ], + "faces": { + "up": { "texture": "#redstone_antenna", "uv": [ 1, 1, 2, 2 ] } + } + }, + { + "name": "Dish", + "from": [ -1, 7, 2 ], + "to": [ 4, 7, 7 ], + "faces": { + "up": { "texture": "#redstone_antenna", "uv": [ 4, 0, 9, 5 ] }, + "down": { "texture": "#redstone_antenna", "uv": [ 4, 0, 9, 5 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/redstone_bridge_receiver_powered.json b/src/main/resources/assets/create/models/block/redstone_bridge_receiver_powered.json new file mode 100644 index 000000000..e4390614c --- /dev/null +++ b/src/main/resources/assets/create/models/block/redstone_bridge_receiver_powered.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/redstone_bridge_receiver", + "textures": { + "redstone_antenna": "create:block/redstone_antenna_powered", + "redstone_bridge": "create:block/redstone_bridge_powered", + "particle": "create:block/redstone_bridge_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/redstone_bridge_receiver_side.json b/src/main/resources/assets/create/models/block/redstone_bridge_receiver_side.json new file mode 100644 index 000000000..4e481b676 --- /dev/null +++ b/src/main/resources/assets/create/models/block/redstone_bridge_receiver_side.json @@ -0,0 +1,70 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)", + "parent": "block/block", + "textures": { + "redstone_antenna": "create:block/redstone_antenna", + "redstone_bridge_side": "create:block/redstone_bridge_side", + "particle": "create:block/redstone_bridge_side" + }, + "elements": [ + { + "name": "Body", + "from": [ 3, 0, 1 ], + "to": [ 13, 3, 15 ], + "faces": { + "north": { "texture": "#redstone_bridge_side", "uv": [ 13, 2, 16, 12 ], "rotation": 90 }, + "east": { "texture": "#redstone_bridge_side", "uv": [ 10, 0, 13, 14 ], "rotation": 90 }, + "south": { "texture": "#redstone_bridge_side", "uv": [ 13, 2, 16, 12 ], "rotation": 90 }, + "west": { "texture": "#redstone_bridge_side", "uv": [ 10, 0, 13, 14 ], "rotation": 90 }, + "up": { "texture": "#redstone_bridge_side", "uv": [ 0, 0, 10, 14 ] } + } + }, + { + "name": "Bottom", + "from": [ 3, -1, 1 ], + "to": [ 13, 0, 15 ], + "faces": { + "north": { "texture": "#redstone_bridge_side", "uv": [ 15, 1, 16, 13 ], "rotation": 270 }, + "east": { "texture": "#redstone_bridge_side", "uv": [ 14, 0, 15, 14 ], "rotation": 270 }, + "south": { "texture": "#redstone_bridge_side", "uv": [ 15, 1, 16, 13 ], "rotation": 90 }, + "west": { "texture": "#redstone_bridge_side", "uv": [ 14, 0, 15, 14 ], "rotation": 90 } + } + }, + { + "name": "AntennaX", + "from": [ 3, 3, -5 ], + "to": [ 6, 4, 5 ], + "faces": { + "south": { "texture": "#redstone_antenna", "uv": [ 0, 9, 3, 10 ] }, + "up": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }, + "down": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ], "rotation": 180 } + } + }, + { + "name": "AntennaZ", + "from": [ 4, 2, -5 ], + "to": [ 5, 5, 5 ], + "faces": { + "east": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ], "rotation": 90 }, + "west": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ], "rotation": 270 } + } + }, + { + "name": "AntennaTop", + "from": [ 4, 3, -4 ], + "to": [ 5, 4, -3 ], + "faces": { + "north": { "texture": "#redstone_antenna", "uv": [ 1, 1, 2, 2 ] } + } + }, + { + "name": "Dish", + "from": [ 2, 1, -1 ], + "to": [ 7, 6, -1 ], + "faces": { + "north": { "texture": "#redstone_antenna", "uv": [ 4, 0, 9, 5 ] }, + "south": { "texture": "#redstone_antenna", "uv": [ 4, 0, 9, 5 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/redstone_bridge_receiver_side_powered.json b/src/main/resources/assets/create/models/block/redstone_bridge_receiver_side_powered.json new file mode 100644 index 000000000..e395ee7bf --- /dev/null +++ b/src/main/resources/assets/create/models/block/redstone_bridge_receiver_side_powered.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/redstone_bridge_receiver_side", + "textures": { + "redstone_antenna": "create:block/redstone_antenna_powered", + "redstone_bridge_side": "create:block/redstone_bridge_side_powered", + "particle": "create:block/redstone_bridge_powered" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/redstone_bridge_side.json b/src/main/resources/assets/create/models/block/redstone_bridge_side.json index 41798dcc1..e57fc79bd 100644 --- a/src/main/resources/assets/create/models/block/redstone_bridge_side.json +++ b/src/main/resources/assets/create/models/block/redstone_bridge_side.json @@ -4,47 +4,57 @@ "textures": { "redstone_antenna": "create:block/redstone_antenna", "redstone_bridge_side": "create:block/redstone_bridge_side", - "particle": "#redstone_bridge_side" + "particle": "create:block/redstone_bridge_side" }, "elements": [ { - "name": "Controller", - "from": [ 3, 1, -1 ], - "to": [ 13, 15, 2 ], + "name": "Body", + "from": [ 3, 0, 1 ], + "to": [ 13, 3, 15 ], "faces": { - "north": { "texture": "#redstone_bridge_side", "uv": [ 0, 0, 10, 14 ] }, - "east": { "texture": "#redstone_bridge_side", "uv": [ 10, 0, 13, 14 ] }, - "south": { "texture": "#redstone_bridge_side", "uv": [ 0, 0, 10, 14 ] }, - "west": { "texture": "#redstone_bridge_side", "uv": [ 10, 0, 13, 14 ], "rotation": 180 }, - "up": { "texture": "#redstone_bridge_side", "uv": [ 13, 0, 16, 10 ], "rotation": 270 }, - "down": { "texture": "#redstone_bridge_side", "uv": [ 13, 0, 16, 10 ], "rotation": 90 } + "north": { "texture": "#redstone_bridge_side", "uv": [ 13, 2, 16, 12 ], "rotation": 90 }, + "east": { "texture": "#redstone_bridge_side", "uv": [ 10, 0, 13, 14 ], "rotation": 90 }, + "south": { "texture": "#redstone_bridge_side", "uv": [ 13, 2, 16, 12 ], "rotation": 90 }, + "west": { "texture": "#redstone_bridge_side", "uv": [ 10, 0, 13, 14 ], "rotation": 90 }, + "up": { "texture": "#redstone_bridge_side", "uv": [ 0, 0, 10, 14 ] } + } + }, + { + "name": "Bottom", + "from": [ 3, -1, 1 ], + "to": [ 13, 0, 15 ], + "faces": { + "north": { "texture": "#redstone_bridge_side", "uv": [ 15, 1, 16, 13 ], "rotation": 270 }, + "east": { "texture": "#redstone_bridge_side", "uv": [ 14, 0, 15, 14 ], "rotation": 270 }, + "south": { "texture": "#redstone_bridge_side", "uv": [ 15, 1, 16, 13 ], "rotation": 90 }, + "west": { "texture": "#redstone_bridge_side", "uv": [ 14, 0, 15, 14 ], "rotation": 90 } } }, { "name": "AntennaX", - "from": [ 3, 11, 2 ], - "to": [ 6, 21, 3 ], + "from": [ 3, 3, -5 ], + "to": [ 6, 4, 5 ], "faces": { - "north": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }, - "south": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }, - "down": { "texture": "#redstone_antenna", "uv": [ 0, 9, 3, 10 ] } + "south": { "texture": "#redstone_antenna", "uv": [ 0, 9, 3, 10 ] }, + "up": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }, + "down": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ], "rotation": 180 } } }, { "name": "AntennaZ", - "from": [ 4, 11, 1 ], - "to": [ 5, 21, 4 ], + "from": [ 4, 2, -5 ], + "to": [ 5, 5, 5 ], "faces": { - "east": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }, - "west": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] } + "east": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ], "rotation": 90 }, + "west": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ], "rotation": 270 } } }, { "name": "AntennaTop", - "from": [ 4, 19, 2 ], - "to": [ 5, 20, 3 ], + "from": [ 4, 3, -4 ], + "to": [ 5, 4, -3 ], "faces": { - "up": { "texture": "#redstone_antenna", "uv": [ 1, 1, 2, 2 ] } + "north": { "texture": "#redstone_antenna", "uv": [ 1, 1, 2, 2 ] } } } ] diff --git a/src/main/resources/assets/create/models/block/redstone_bridge_side_powered.json b/src/main/resources/assets/create/models/block/redstone_bridge_side_powered.json index c32b98bf0..67f6d2a4f 100644 --- a/src/main/resources/assets/create/models/block/redstone_bridge_side_powered.json +++ b/src/main/resources/assets/create/models/block/redstone_bridge_side_powered.json @@ -2,6 +2,7 @@ "parent": "create:block/redstone_bridge_side", "textures": { "redstone_antenna": "create:block/redstone_antenna_powered", - "redstone_bridge_side": "create:block/redstone_bridge_side_powered" + "redstone_bridge_side": "create:block/redstone_bridge_side_powered", + "particle": "create:block/redstone_bridge_powered" } } \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/stockpile_switch.json b/src/main/resources/assets/create/models/block/stockpile_switch.json new file mode 100644 index 000000000..c30e2a3a3 --- /dev/null +++ b/src/main/resources/assets/create/models/block/stockpile_switch.json @@ -0,0 +1,92 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)", + "parent": "block/block", + "textures": { + "progress": "create:block/indicator/0", + "brass_casing": "create:block/brass_casing", + "dark_oak_planks": "minecraft:block/dark_oak_planks", + "iron_block": "minecraft:block/iron_block", + "particle": "create:block/brass_casing" + }, + "elements": [ + { + "name": "Indicator", + "from": [ 1, 2, 13 ], + "to": [ 4, 14, 16 ], + "faces": { + "east": { "texture": "#progress", "uv": [ 0, 2, 3, 14 ] }, + "south": { "texture": "#progress", "uv": [ 1, 2, 4, 14 ] }, + "west": { "texture": "#progress", "uv": [ 0, 2, 3, 14 ] } + } + }, + { + "name": "Bottom Plate", + "from": [ 0, 0, 0 ], + "to": [ 16, 2, 16 ], + "faces": { + "north": { "texture": "#brass_casing", "uv": [ 0, 14, 16, 16 ] }, + "east": { "texture": "#brass_casing", "uv": [ 0, 14, 16, 16 ] }, + "south": { "texture": "#brass_casing", "uv": [ 0, 14, 16, 16 ] }, + "west": { "texture": "#brass_casing", "uv": [ 0, 14, 16, 16 ] }, + "up": { "texture": "#brass_casing", "uv": [ 0, 0, 16, 16 ] }, + "down": { "texture": "#brass_casing", "uv": [ 0, 0, 16, 16 ] } + } + }, + { + "name": "Top Plate", + "from": [ 0, 14, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "north": { "texture": "#brass_casing", "uv": [ 0, 0, 16, 2 ] }, + "east": { "texture": "#brass_casing", "uv": [ 0, 0, 16, 2 ] }, + "south": { "texture": "#brass_casing", "uv": [ 0, 0, 16, 2 ] }, + "west": { "texture": "#brass_casing", "uv": [ 0, 0, 16, 2 ] }, + "up": { "texture": "#brass_casing", "uv": [ 0, 0, 16, 16 ] }, + "down": { "texture": "#brass_casing", "uv": [ 0, 0, 16, 16 ] } + } + }, + { + "name": "Side Plate", + "from": [ 14, 2, 0 ], + "to": [ 16, 14, 16 ], + "faces": { + "north": { "texture": "#brass_casing", "uv": [ 0, 2, 2, 14 ] }, + "east": { "texture": "#brass_casing", "uv": [ 0, 2, 16, 14 ] }, + "south": { "texture": "#brass_casing", "uv": [ 14, 2, 16, 14 ] }, + "west": { "texture": "#brass_casing", "uv": [ 0, 2, 16, 14 ] } + } + }, + { + "name": "Center", + "from": [ 2, 2, 1 ], + "to": [ 14, 14, 15 ], + "faces": { + "north": { "texture": "#dark_oak_planks", "uv": [ 0, 0, 12, 12 ] }, + "south": { "texture": "#dark_oak_planks", "uv": [ 0, 0, 12, 12 ] }, + "west": { "texture": "#dark_oak_planks", "uv": [ 0, 0, 14, 12 ] } + } + }, + { + "name": "Indicator", + "from": [ -1, 2, 2 ], + "to": [ 1, 14, 14 ], + "faces": { + "north": { "texture": "#iron_block", "uv": [ 14, 2, 16, 14 ] }, + "south": { "texture": "#iron_block", "uv": [ 0, 2, 2, 14 ] }, + "west": { "texture": "#iron_block", "uv": [ 2, 2, 14, 14 ] }, + "up": { "texture": "#iron_block", "uv": [ 2, 0, 14, 2 ], "rotation": 270 }, + "down": { "texture": "#iron_block", "uv": [ 2, 14, 14, 16 ], "rotation": 90 } + } + }, + { + "name": "Indicator", + "from": [ 1, 2, 0 ], + "to": [ 4, 14, 3 ], + "faces": { + "north": { "texture": "#progress", "uv": [ 0, 2, 3, 14 ] }, + "east": { "texture": "#progress", "uv": [ 1, 2, 4, 14 ] }, + "west": { "texture": "#progress", "uv": [ 1, 2, 4, 14 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/stockpile_switch_1.json b/src/main/resources/assets/create/models/block/stockpile_switch_1.json new file mode 100644 index 000000000..f8d6edca1 --- /dev/null +++ b/src/main/resources/assets/create/models/block/stockpile_switch_1.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/stockpile_switch", + "textures": { + "progress": "create:block/indicator/1" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/stockpile_switch_2.json b/src/main/resources/assets/create/models/block/stockpile_switch_2.json new file mode 100644 index 000000000..1e2d3278e --- /dev/null +++ b/src/main/resources/assets/create/models/block/stockpile_switch_2.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/stockpile_switch", + "textures": { + "progress": "create:block/indicator/2" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/stockpile_switch_3.json b/src/main/resources/assets/create/models/block/stockpile_switch_3.json new file mode 100644 index 000000000..cc7518686 --- /dev/null +++ b/src/main/resources/assets/create/models/block/stockpile_switch_3.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/stockpile_switch", + "textures": { + "progress": "create:block/indicator/3" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/stockpile_switch_4.json b/src/main/resources/assets/create/models/block/stockpile_switch_4.json new file mode 100644 index 000000000..d3e052411 --- /dev/null +++ b/src/main/resources/assets/create/models/block/stockpile_switch_4.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/stockpile_switch", + "textures": { + "progress": "create:block/indicator/4" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/stockpile_switch_5.json b/src/main/resources/assets/create/models/block/stockpile_switch_5.json new file mode 100644 index 000000000..b99d92e0b --- /dev/null +++ b/src/main/resources/assets/create/models/block/stockpile_switch_5.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/stockpile_switch", + "textures": { + "progress": "create:block/indicator/5" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/stockpile_switch_6.json b/src/main/resources/assets/create/models/block/stockpile_switch_6.json new file mode 100644 index 000000000..d25d07ae7 --- /dev/null +++ b/src/main/resources/assets/create/models/block/stockpile_switch_6.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/stockpile_switch", + "textures": { + "progress": "create:block/indicator/6" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/flexcrate.json b/src/main/resources/assets/create/models/item/flexcrate.json new file mode 100644 index 000000000..8e844dbae --- /dev/null +++ b/src/main/resources/assets/create/models/item/flexcrate.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/flex_crate" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/stockswitch.json b/src/main/resources/assets/create/models/item/stockswitch.json new file mode 100644 index 000000000..8c0271645 --- /dev/null +++ b/src/main/resources/assets/create/models/item/stockswitch.json @@ -0,0 +1,10 @@ +{ + "parent": "create:block/stockpile_switch_4", + "display": { + "gui": { + "rotation": [ 30, 45, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.625, 0.625, 0.625 ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/indicator/0.png b/src/main/resources/assets/create/textures/block/indicator/0.png new file mode 100644 index 000000000..587a8cf84 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/indicator/0.png differ diff --git a/src/main/resources/assets/create/textures/block/indicator/1.png b/src/main/resources/assets/create/textures/block/indicator/1.png new file mode 100644 index 000000000..99db8f666 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/indicator/1.png differ diff --git a/src/main/resources/assets/create/textures/block/indicator/2.png b/src/main/resources/assets/create/textures/block/indicator/2.png new file mode 100644 index 000000000..f0b9cdd5c Binary files /dev/null and b/src/main/resources/assets/create/textures/block/indicator/2.png differ diff --git a/src/main/resources/assets/create/textures/block/indicator/3.png b/src/main/resources/assets/create/textures/block/indicator/3.png new file mode 100644 index 000000000..fdee59c07 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/indicator/3.png differ diff --git a/src/main/resources/assets/create/textures/block/indicator/4.png b/src/main/resources/assets/create/textures/block/indicator/4.png new file mode 100644 index 000000000..886099dfe Binary files /dev/null and b/src/main/resources/assets/create/textures/block/indicator/4.png differ diff --git a/src/main/resources/assets/create/textures/block/indicator/5.png b/src/main/resources/assets/create/textures/block/indicator/5.png new file mode 100644 index 000000000..289ff99db Binary files /dev/null and b/src/main/resources/assets/create/textures/block/indicator/5.png differ diff --git a/src/main/resources/assets/create/textures/block/indicator/6.png b/src/main/resources/assets/create/textures/block/indicator/6.png new file mode 100644 index 000000000..43826d8c2 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/indicator/6.png differ diff --git a/src/main/resources/assets/create/textures/block/redstone_antenna.png b/src/main/resources/assets/create/textures/block/redstone_antenna.png index 3dd71671a..8719db70b 100644 Binary files a/src/main/resources/assets/create/textures/block/redstone_antenna.png and b/src/main/resources/assets/create/textures/block/redstone_antenna.png differ diff --git a/src/main/resources/assets/create/textures/block/redstone_antenna_powered.png b/src/main/resources/assets/create/textures/block/redstone_antenna_powered.png index 241e34fe3..6c3d5b696 100644 Binary files a/src/main/resources/assets/create/textures/block/redstone_antenna_powered.png and b/src/main/resources/assets/create/textures/block/redstone_antenna_powered.png differ diff --git a/src/main/resources/assets/create/textures/block/redstone_bridge_side.png b/src/main/resources/assets/create/textures/block/redstone_bridge_side.png index 28c13f888..772f9f8b6 100644 Binary files a/src/main/resources/assets/create/textures/block/redstone_bridge_side.png and b/src/main/resources/assets/create/textures/block/redstone_bridge_side.png differ diff --git a/src/main/resources/assets/create/textures/block/redstone_bridge_side_powered.png b/src/main/resources/assets/create/textures/block/redstone_bridge_side_powered.png index 7edf51233..82d8928ce 100644 Binary files a/src/main/resources/assets/create/textures/block/redstone_bridge_side_powered.png and b/src/main/resources/assets/create/textures/block/redstone_bridge_side_powered.png differ diff --git a/src/main/resources/assets/create/textures/gui/flex_crate_and_stockpile_switch.png b/src/main/resources/assets/create/textures/gui/flex_crate_and_stockpile_switch.png new file mode 100644 index 000000000..e577df074 Binary files /dev/null and b/src/main/resources/assets/create/textures/gui/flex_crate_and_stockpile_switch.png differ