Logistics and Tooltips

- Added an option to register stairs, slabs and other together with the main Block
- Added Skeleton for FlexCrate
- Added Skeleton for Redstone Bridge
- Added Skeleton for Stockpile Switch
- Generalized tooltips between blocks and items
- Added more tooltips to existing blocks
This commit is contained in:
simibubi 2019-08-25 10:14:15 +02:00
parent efcdd3c03e
commit bbe6150c0f
53 changed files with 1048 additions and 184 deletions

View file

@ -1,6 +1,7 @@
package com.simibubi.create;
import com.simibubi.create.foundation.block.IWithoutBlockItem;
import com.simibubi.create.foundation.block.ProperStairsBlock;
import com.simibubi.create.foundation.block.RenderUtilityAxisBlock;
import com.simibubi.create.foundation.block.RenderUtilityBlock;
import com.simibubi.create.modules.contraptions.base.HalfAxisBlock;
@ -24,6 +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.RedstoneBridgeBlock;
import com.simibubi.create.modules.logistics.StockpileSwitchBlock;
import com.simibubi.create.modules.schematics.block.CreativeCrateBlock;
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
@ -35,7 +39,11 @@ import net.minecraft.block.Block;
import net.minecraft.block.Block.Properties;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FenceBlock;
import net.minecraft.block.FenceGateBlock;
import net.minecraft.block.RotatedPillarBlock;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.WallBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraftforge.registries.IForgeRegistry;
@ -81,6 +89,11 @@ public enum AllBlocks {
HARVESTER(new HarvesterBlock()),
CONTACT(new ContactBlock()),
// Logistics
REDSTONE_BRIDGE(new RedstoneBridgeBlock()),
STOCKPILE_SWITCH(new StockpileSwitchBlock()),
FLEX_CRATE(new FlexCrateBlock()),
// Symmetry
SYMMETRY_PLANE(new PlaneSymmetryBlock()),
SYMMETRY_CROSSPLANE(new CrossPlaneSymmetryBlock()),
@ -118,16 +131,27 @@ public enum AllBlocks {
;
public Block block;
private enum ComesWith {
WALL, FENCE, FENCE_GATE, SLAB, STAIRS;
}
private AllBlocks(Block block) {
public Block block;
public Block[] alsoRegistered;
private AllBlocks(Block block, ComesWith... comesWith) {
this.block = block;
this.block.setRegistryName(Create.ID, this.name().toLowerCase());
alsoRegistered = new Block[comesWith.length];
for (int i = 0; i < comesWith.length; i++)
alsoRegistered[i] = makeRelatedBlock(block, comesWith[i]);
}
public static void registerBlocks(IForgeRegistry<Block> registry) {
for (AllBlocks block : values()) {
registry.register(block.block);
for (Block extra : block.alsoRegistered)
registry.register(extra);
}
}
@ -136,11 +160,17 @@ public enum AllBlocks {
if (block.get() instanceof IWithoutBlockItem)
continue;
registry.register(new BlockItem(block.get(), AllItems.standardProperties())
.setRegistryName(block.get().getRegistryName()));
registerAsItem(registry, block.get());
for (Block extra : block.alsoRegistered)
registerAsItem(registry, extra);
}
}
private static void registerAsItem(IForgeRegistry<Item> registry, Block blockIn) {
registry.register(
new BlockItem(blockIn, AllItems.standardProperties()).setRegistryName(blockIn.getRegistryName()));
}
public Block get() {
return block;
}
@ -149,4 +179,32 @@ public enum AllBlocks {
return state.getBlock() == block;
}
private Block makeRelatedBlock(Block block, ComesWith feature) {
Properties properties = Properties.from(block);
Block featured = null;
switch (feature) {
case FENCE:
featured = new FenceBlock(properties);
break;
case SLAB:
featured = new SlabBlock(properties);
break;
case STAIRS:
featured = new ProperStairsBlock(block);
break;
case WALL:
featured = new WallBlock(properties);
break;
case FENCE_GATE:
featured = new FenceGateBlock(properties);
break;
default:
return null;
}
return featured.setRegistryName(Create.ID,
block.getRegistryName().getPath() + "_" + feature.name().toLowerCase());
}
}

View file

@ -1,5 +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.schematics.block.SchematicTableContainer;
import com.simibubi.create.modules.schematics.block.SchematicTableScreen;
import com.simibubi.create.modules.schematics.block.SchematicannonContainer;
@ -26,6 +28,7 @@ public enum AllContainers {
SchematicTable(SchematicTableContainer::new),
Schematicannon(SchematicannonContainer::new),
FlexCrate(FlexCrateContainer::new),
;
@ -50,6 +53,7 @@ public enum AllContainers {
public static void registerScreenFactories() {
bind(SchematicTable, SchematicTableScreen::new);
bind(Schematicannon, SchematicannonScreen::new);
bind(FlexCrate, FlexCrateScreen::new);
}
@OnlyIn(Dist.CLIENT)

View file

@ -21,6 +21,9 @@ 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.RedstoneBridgeTileEntity;
import com.simibubi.create.modules.logistics.StockpileSwitchTileEntity;
import com.simibubi.create.modules.schematics.block.SchematicTableTileEntity;
import com.simibubi.create.modules.schematics.block.SchematicannonRenderer;
import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity;
@ -57,6 +60,11 @@ public enum AllTileEntities {
CRUSHING_WHEEL_CONTROLLER(CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER),
WATER_WHEEL(WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL),
// Logistics
REDSTONE_BRIDGE(RedstoneBridgeTileEntity::new, AllBlocks.REDSTONE_BRIDGE),
STOCKPILE_SWITCH(StockpileSwitchTileEntity::new, AllBlocks.STOCKPILE_SWITCH),
FLEX_CRATE(FlexCrateTileEntity::new, AllBlocks.FLEX_CRATE),
;
private Supplier<? extends TileEntity> supplier;

View file

@ -0,0 +1,32 @@
package com.simibubi.create.foundation.block;
import java.util.List;
import com.simibubi.create.foundation.utility.ITooltip;
import com.simibubi.create.foundation.utility.TooltipHolder;
import net.minecraft.block.Block;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class InfoBlock extends Block implements ITooltip {
protected TooltipHolder info;
public InfoBlock(Properties properties) {
super(properties);
info = new TooltipHolder(this);
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
}

View file

@ -0,0 +1,12 @@
package com.simibubi.create.foundation.block;
import net.minecraft.block.Block;
import net.minecraft.block.StairsBlock;
public class ProperStairsBlock extends StairsBlock {
public ProperStairsBlock(Block block) {
super(block.getDefaultState(), Properties.from(block));
}
}

View file

@ -0,0 +1,31 @@
package com.simibubi.create.foundation.item;
import java.util.List;
import com.simibubi.create.foundation.utility.ITooltip;
import com.simibubi.create.foundation.utility.TooltipHolder;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class InfoItem extends Item implements ITooltip {
protected TooltipHolder info;
public InfoItem(Properties properties) {
super(properties);
info = new TooltipHolder(this);
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
}

View file

@ -1,39 +0,0 @@
package com.simibubi.create.foundation.item;
import java.util.List;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class ItemWithToolTip extends Item {
protected TooltipCache tooltip;
public ItemWithToolTip(Properties properties) {
super(properties);
tooltip = new TooltipCache();
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
ItemDescription itemDescription = this.tooltip.getOrCreate(this::getDescription);
itemDescription.addInformation(tooltip);
super.addInformation(stack, worldIn, tooltip, flagIn);
}
protected abstract ItemDescription getDescription();
protected String h(String s, Palette palette) {
return ItemDescription.hightlight(s, palette);
}
}

View file

@ -1,17 +0,0 @@
package com.simibubi.create.foundation.item;
import java.util.function.Supplier;
import com.simibubi.create.foundation.utility.ItemDescription;
public class TooltipCache {
private ItemDescription toolTip;
public ItemDescription getOrCreate(Supplier<ItemDescription> factory) {
if (toolTip == null)
toolTip = factory.get();
return toolTip;
}
}

View file

@ -0,0 +1,13 @@
package com.simibubi.create.foundation.utility;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
public interface ITooltip {
public ItemDescription getDescription();
public default String h(String s, Palette palette) {
return ItemDescription.hightlight(s, palette);
}
}

View file

@ -0,0 +1,19 @@
package com.simibubi.create.foundation.utility;
import java.util.List;
import net.minecraft.util.text.ITextComponent;
public class TooltipHolder {
private ItemDescription toolTip;
public TooltipHolder(ITooltip item) {
toolTip = item.getDescription();
}
public void addInformation(List<ITextComponent> tooltip) {
toolTip.addInformation(tooltip);
}
}

View file

@ -1,8 +1,9 @@
package com.simibubi.create.modules.contraptions.base;
import com.simibubi.create.foundation.block.InfoBlock;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.modules.contraptions.RotationPropagator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.PushReaction;
import net.minecraft.tileentity.TileEntity;
@ -14,7 +15,9 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public abstract class KineticBlock extends Block implements IRotate {
public abstract class KineticBlock extends InfoBlock implements IRotate {
protected static final Palette color = Palette.Red;
public KineticBlock(Properties properties) {
super(properties);

View file

@ -1,5 +1,6 @@
package com.simibubi.create.modules.contraptions.generators;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import net.minecraft.block.BlockState;
@ -48,4 +49,13 @@ public class MotorBlock extends HorizontalKineticBlock {
protected boolean hasStaticPart() {
return true;
}
// IToolTip
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("Provides Rotational Power.").withControl("When R-Clicked",
"Opens the " + h("Configuration Screen", color)).createTabs();
}
}

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.contraptions.generators;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import net.minecraft.block.BlockState;
@ -131,4 +132,10 @@ public class WaterWheelBlock extends HorizontalKineticBlock {
return state.get(HORIZONTAL_FACING).getAxis();
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("Creates Rotational Power from " + h("Water flows", color) + " around it.")
.createTabs();
}
}

View file

@ -3,6 +3,7 @@ package com.simibubi.create.modules.contraptions.receivers;
import static com.simibubi.create.modules.contraptions.receivers.CrushingWheelControllerBlock.VALID;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
@ -166,4 +167,14 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock {
return false;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Using rotational force, two of these Wheels can grind up anything that falls into them.")
.withBehaviour("When next other Wheel",
"Grinds up Mobs, Players and Items into their components. Wheels have to rotate at exact "
+ h("Opposite Speeds", color) + ", dragging inputs into them from above.")
.createTabs();
}
}

View file

@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.receivers;
import java.util.List;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior;
@ -167,4 +168,14 @@ public class DrillBlock extends DirectionalKineticBlock implements IHaveMovement
return false;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Using Rotational Force, this component can break blocks in front of it.")
.withBehaviour("When Rotated", h("Breaks blocks", color) + " right in front of it.")
.withBehaviour("When being pushed by Mechanical Piston",
h("Breaks the Blocks", color) + " it is being pushed into.")
.createTabs();
}
}

View file

@ -3,6 +3,10 @@ package com.simibubi.create.modules.contraptions.receivers;
import java.util.List;
import com.simibubi.create.AllBlocks;
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 com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonTileEntity;
@ -12,6 +16,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.CropsBlock;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.SugarCaneBlock;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
@ -26,20 +31,24 @@ 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.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.IPlantable;
public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBehavior {
public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBehavior, ITooltip {
public static final VoxelShape SHAPE_SOUTH = makeCuboidShape(0, 4, 0, 16, 12, 6),
SHAPE_NORTH = makeCuboidShape(0, 4, 10, 16, 12, 16), SHAPE_WEST = makeCuboidShape(10, 4, 0, 16, 12, 16),
SHAPE_EAST = makeCuboidShape(0, 4, 0, 6, 12, 16);
private TooltipHolder info;
public HarvesterBlock() {
super(Properties.from(Blocks.IRON_BLOCK));
info = new TooltipHolder(this);
}
@Override
@ -199,4 +208,20 @@ public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBeha
return Blocks.AIR.getDefaultState();
}
@Override
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Red;
return new ItemDescription(color).withSummary("Ideal for cutting crops using Mechanical Constructs.")
.withBehaviour("When pushed by Mechanical Piston",
"Cuts Crops to their initial growth state and drops their harvest.")
.createTabs();
}
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.modules.contraptions.receivers;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.KineticBlock;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -65,7 +66,7 @@ public class TurntableBlock extends KineticBlock {
if (!world.isRemote && (e instanceof PlayerEntity))
return;
if (offset.length() > 1/16f) {
if (offset.length() > 1 / 16f) {
offset = VecHelper.rotate(offset, speed / 1f, Axis.Y);
Vec3d movement = origin.add(offset).subtract(e.getPositionVec());
e.setMotion(e.getMotion().add(movement));
@ -84,7 +85,6 @@ public class TurntableBlock extends KineticBlock {
return;
}
e.rotationYaw -= speed;
}
@ -106,4 +106,10 @@ public class TurntableBlock extends KineticBlock {
return false;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("Turns rotational Force into raw Motion Sickness.")
.withBehaviour("When Rotated", "Rotates any Entities standing on top.").createTabs();
}
}

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.contraptions.receivers.constructs;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.KineticBlock;
import net.minecraft.block.Block;
@ -193,4 +194,12 @@ public class MechanicalPistonBlock extends KineticBlock {
return VoxelShapes.fullCube();
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("With " + h("Piston Poles", color) + " at the rear, will "
+ h("move Attached Structures", color) + " based on its input rotation speed.")
.withBehaviour("When Rotated", "Translates attached Structure accordingly.").createTabs();
}
}

View file

@ -1,13 +1,21 @@
package com.simibubi.create.modules.contraptions.receivers.constructs;
import java.util.List;
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.modules.contraptions.receivers.constructs.MechanicalPistonBlock.PistonState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
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.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
@ -16,14 +24,27 @@ import net.minecraft.util.math.BlockPos;
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.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PistonPoleBlock extends ProperDirectionalBlock {
public class PistonPoleBlock extends ProperDirectionalBlock implements ITooltip {
private TooltipHolder info;
public PistonPoleBlock() {
super(Properties.from(Blocks.PISTON_HEAD));
setDefaultState(getDefaultState().with(FACING, Direction.UP));
info = new TooltipHolder(this);
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
@Override
@ -89,4 +110,12 @@ public class PistonPoleBlock extends ProperDirectionalBlock {
return getDefaultState().with(FACING, context.getFace().getOpposite());
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Red;
return new ItemDescription(color).withSummary(
"Attach to the back of a " + h("Mechanical Piston", color) + " to increase its extension length.")
.createTabs();
}
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockState;
@ -61,4 +62,10 @@ public class AxisBlock extends RotatedPillarKineticBlock {
return state.get(AXIS);
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("A straight connection for rotating blocks along its axis.")
.createTabs();
}
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockState;
@ -51,4 +52,10 @@ public class AxisTunnelBlock extends RotatedPillarKineticBlock {
return state.get(AXIS);
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Relays a rotation through its block, similar to an exposed Axle.").createTabs();
}
}

View file

@ -6,6 +6,7 @@ import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.block.IWithoutBlockItem;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import com.simibubi.create.modules.contraptions.relays.BeltTileEntity.TransportedEntityInfo;
@ -208,6 +209,8 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (worldIn.isRemote)
return;
boolean endWasDestroyed = state.get(PART) == Part.END;
TileEntity tileEntity = worldIn.getTileEntity(pos);
if (tileEntity == null)
return;
@ -243,6 +246,9 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt
if (destroyedBlock.get(PART) == Part.END)
break;
} else {
if (endWasDestroyed)
break;
}
Slope slope = state.get(SLOPE);
@ -364,4 +370,9 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt
return shape;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color);
}
}

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.contraptions.relays;
import com.google.common.base.Predicates;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.Block;
@ -103,4 +104,13 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
return true;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Relays rotation through its block and to an attached Encased Belt.")
.withBehaviour("When Attached to other Encased Belt",
"Attached Block will have the exact same rotation speed and direction. Attached Belts do not have to face the same way.")
.createTabs();
}
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockState;
@ -39,4 +40,12 @@ public class GearboxBlock extends RotatedPillarKineticBlock {
return true;
}
// IToolTip
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Relays Rotation to Four directions. Reverses straight connections.").createTabs();
}
}

View file

@ -12,7 +12,7 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.AllPackets;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.item.ItemWithToolTip;
import com.simibubi.create.foundation.item.InfoItem;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
@ -61,10 +61,11 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.PacketDistributor;
public class BuilderGunItem extends ItemWithToolTip {
public class BuilderGunItem extends InfoItem {
public static enum ComponentTier {
None(TextFormatting.DARK_GRAY + "Andesite Alloy"), BlazeBrass(TextFormatting.GOLD + "Blaze Brass"),
None(TextFormatting.DARK_GRAY + "Andesite Alloy"),
BlazeBrass(TextFormatting.GOLD + "Blaze Brass"),
ChorusChrome(TextFormatting.LIGHT_PURPLE + "Chorus Chrome"),
;
@ -90,7 +91,7 @@ public class BuilderGunItem extends ItemWithToolTip {
}
@Override
protected ItemDescription getDescription() {
public ItemDescription getDescription() {
Palette palette = Palette.Purple;
return new ItemDescription(palette).withSummary("Novel gadget for placing or exchanging blocks at a distance.")
.withControl("L-Click at Block", "Sets blocks placed by the tool to the targeted block.")

View file

@ -6,7 +6,7 @@ import java.util.List;
import java.util.Random;
import java.util.function.Predicate;
import com.simibubi.create.foundation.item.ItemWithToolTip;
import com.simibubi.create.foundation.item.InfoItem;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
@ -31,14 +31,14 @@ import net.minecraft.world.ITickList;
import net.minecraft.world.World;
import net.minecraft.world.storage.MapData;
public class TreeFertilizerItem extends ItemWithToolTip {
public class TreeFertilizerItem extends InfoItem {
public TreeFertilizerItem(Properties properties) {
super(properties);
}
@Override
protected ItemDescription getDescription() {
public ItemDescription getDescription() {
return new ItemDescription(Palette.Green)
.withSummary("A powerful combination of minerals suitable for common tree types.")
.withBehaviour("When used on Sapling", "Grows Trees regardless of their spacing Conditions").createTabs();

View file

@ -0,0 +1,36 @@
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.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
public class FlexCrateBlock extends InfoBlock {
public FlexCrateBlock() {
super(Properties.from(Blocks.ANDESITE));
}
@Override
public boolean hasTileEntity() {
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. Can hold up to "
+ h("16 Stacks", color) + " of Items.");
}
}

View file

@ -0,0 +1,39 @@
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.network.PacketBuffer;
public class FlexCrateContainer extends Container {
private FlexCrateTileEntity te;
public FlexCrateContainer(int id, PlayerInventory inv, PacketBuffer extraData) {
super(AllContainers.SchematicTable.type, id);
ClientWorld world = Minecraft.getInstance().world;
this.te = (FlexCrateTileEntity) world.getTileEntity(extraData.readBlockPos());
this.te.handleUpdateTag(extraData.readCompoundTag());
init();
}
public FlexCrateContainer(int id, PlayerInventory inv, FlexCrateTileEntity te) {
super(AllContainers.SchematicTable.type, id);
this.te = te;
init();
}
private void init() {
}
@Override
public boolean canInteractWith(PlayerEntity playerIn) {
return true;
}
}

View file

@ -0,0 +1,19 @@
package com.simibubi.create.modules.logistics;
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
public class FlexCrateScreen extends AbstractSimiContainerScreen<FlexCrateContainer> {
public FlexCrateScreen(FlexCrateContainer container, PlayerInventory inv, ITextComponent title) {
super(container, inv, title);
}
@Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
}
}

View file

@ -0,0 +1,29 @@
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.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public class FlexCrateTileEntity extends SyncedTileEntity implements INamedContainerProvider {
public FlexCrateTileEntity() {
super(AllTileEntities.FLEX_CRATE.type);
}
@Override
public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player) {
return new FlexCrateContainer(id, inventory, this);
}
@Override
public ITextComponent getDisplayName() {
return new StringTextComponent(getType().getRegistryName().toString());
}
}

View file

@ -0,0 +1,134 @@
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.TooltipHolder;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder;
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.math.BlockPos;
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.IWorldReader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITooltip {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
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);
private TooltipHolder info;
public RedstoneBridgeBlock() {
super(Properties.from(Blocks.DARK_OAK_LOG));
info = new TooltipHolder(this);
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(POWERED);
super.fillStateContainer(builder);
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new RedstoneBridgeTileEntity();
}
@Override
public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
return state.get(FACING) == Direction.UP;
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
BlockPos neighbourPos = pos.offset(state.get(FACING).getOpposite());
BlockState neighbour = worldIn.getBlockState(neighbourPos);
return Block.hasSolidSide(neighbour, worldIn, neighbourPos, state.get(FACING));
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
BlockState state = getDefaultState();
state = state.with(FACING, context.getFace());
return state;
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
Direction facing = state.get(FACING);
if (facing == Direction.UP)
return UP_SHAPE;
if (facing == Direction.DOWN)
return DOWN_SHAPE;
if (facing == Direction.EAST)
return EAST_SHAPE;
if (facing == Direction.WEST)
return WEST_SHAPE;
if (facing == Direction.NORTH)
return NORTH_SHAPE;
if (facing == Direction.SOUTH)
return SOUTH_SHAPE;
return VoxelShapes.empty();
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Yellow;
return new ItemDescription(color)
.withSummary("Endpoints for " + h("Wireless Redstone", color) + " connections. Can be assigned "
+ h("Frequencies", color) + " using any item. Signal can travel distances up to "
+ h("128m", color))
.withBehaviour("When Powered",
"Bridges of the same " + h("Frequency", color) + " will provide a Redstone signal.")
.withControl("When R-Clicked with an Item",
"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.")
.createTabs();
}
}

View file

@ -0,0 +1,100 @@
package com.simibubi.create.modules.logistics;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.SyncedTileEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
public class RedstoneBridgeTileEntity extends SyncedTileEntity {
public static final int RANGE = 128;
static Map<Pair<Frequency, Frequency>, List<RedstoneBridgeTileEntity>> connections;
public static class Frequency {
private ItemStack stack;
private Item item;
private int color;
public Frequency(ItemStack stack) {
this.stack = stack;
item = stack.getItem();
CompoundNBT displayTag = stack.getChildTag("display");
color = displayTag != null && displayTag.contains("color") ? displayTag.getInt("color") : -1;
}
public ItemStack getStack() {
return stack;
}
@Override
public int hashCode() {
return item.hashCode() ^ color;
}
@Override
public boolean equals(Object obj) {
return obj instanceof Frequency ? ((Frequency) obj).item == item && ((Frequency) obj).color == color
: false;
}
}
public Frequency frequencyFirst;
public Frequency frequencyLast;
public RedstoneBridgeTileEntity() {
super(AllTileEntities.REDSTONE_BRIDGE.type);
frequencyFirst = new Frequency(ItemStack.EMPTY);
frequencyLast = new Frequency(ItemStack.EMPTY);
}
@Override
public void onLoad() {
super.onLoad();
if (world.isRemote)
return;
Pair<Frequency, Frequency> networkKey = getNetworkKey();
List<RedstoneBridgeTileEntity> TEs = connections.getOrDefault(networkKey, new ArrayList<>());
TEs.add(this);
connections.put(networkKey, TEs);
}
@Override
public void remove() {
super.remove();
Pair<Frequency, Frequency> networkKey = getNetworkKey();
List<RedstoneBridgeTileEntity> TEs = connections.get(networkKey);
if (TEs != null)
TEs.remove(this);
}
protected Pair<Frequency, Frequency> getNetworkKey() {
return Pair.of(frequencyFirst, frequencyLast);
}
@Override
public CompoundNBT write(CompoundNBT compound) {
compound.put("FrequencyFirst", frequencyFirst.getStack().write(new CompoundNBT()));
compound.put("FrequencyLast", frequencyLast.getStack().write(new CompoundNBT()));
return super.write(compound);
}
@Override
public void read(CompoundNBT compound) {
frequencyFirst = new Frequency(ItemStack.read(compound.getCompound("FrequencyFirst")));
frequencyLast = new Frequency(ItemStack.read(compound.getCompound("FrequencyLast")));
super.read(compound);
}
}

View file

@ -0,0 +1,56 @@
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<ITextComponent> 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();
}
}

View file

@ -0,0 +1,5 @@
package com.simibubi.create.modules.logistics;
public class StockpileSwitchScreen {
}

View file

@ -0,0 +1,41 @@
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() {
}
}

View file

@ -1,25 +1,17 @@
package com.simibubi.create.modules.schematics.block;
import java.util.List;
import com.simibubi.create.foundation.block.InfoBlock;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.KeyboardHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class CreativeCrateBlock extends Block {
public class CreativeCrateBlock extends InfoBlock {
protected static final VoxelShape shape = makeCuboidShape(1, 0, 1, 15, 14, 15);
@ -32,19 +24,6 @@ public class CreativeCrateBlock extends Block {
return false;
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
tooltip.add(new StringTextComponent(TextFormatting.LIGHT_PURPLE + "Creative Item"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "Grants an attached " + TextFormatting.BLUE + "Schematicannon"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "unlimited access to blocks."));
} else
tooltip.add(new StringTextComponent(TextFormatting.DARK_GRAY + "< Hold Shift >"));
super.addInformation(stack, worldIn, tooltip, flagIn);
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return shape;
@ -56,4 +35,12 @@ public class CreativeCrateBlock extends Block {
return shape;
}
@Override
public ItemDescription getDescription() {
Palette blue = Palette.Blue;
return new ItemDescription(blue)
.withSummary("Grants an attached " + h("Schematicannon", blue) + " unlimited access to blocks.")
.createTabs();
}
}

View file

@ -2,7 +2,10 @@ package com.simibubi.create.modules.schematics.block;
import java.util.List;
import com.simibubi.create.foundation.utility.KeyboardHelper;
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;
@ -20,18 +23,19 @@ 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.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
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.network.NetworkHooks;
public class SchematicTableBlock extends HorizontalBlock {
public class SchematicTableBlock extends HorizontalBlock implements ITooltip {
private TooltipHolder info;
public SchematicTableBlock() {
super(Properties.from(Blocks.OAK_PLANKS));
info = new TooltipHolder(this);
}
@Override
@ -49,12 +53,7 @@ public class SchematicTableBlock extends HorizontalBlock {
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "Writes saved Schematics onto"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "an " + TextFormatting.BLUE + "Empty Schematic"));
} else
tooltip.add(new StringTextComponent(TextFormatting.DARK_GRAY + "< Hold Shift >"));
super.addInformation(stack, worldIn, tooltip, flagIn);
info.addInformation(tooltip);
}
@Override
@ -103,4 +102,12 @@ public class SchematicTableBlock extends HorizontalBlock {
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Blue;
return new ItemDescription(color).withSummary("Writes saved Schematics onto an " + h("Empty Schematic", color))
.withBehaviour("When given an Empty Schematic", "Uploads the chosen File from your Schematics Folder")
.createTabs();
}
}

View file

@ -1,14 +1,12 @@
package com.simibubi.create.modules.schematics.block;
import java.util.List;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.utility.KeyboardHelper;
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.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.InventoryHelper;
@ -18,18 +16,13 @@ import net.minecraft.util.Direction;
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.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
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.fml.network.NetworkHooks;
public class SchematicannonBlock extends Block {
public class SchematicannonBlock extends InfoBlock {
public SchematicannonBlock() {
super(Properties.from(Blocks.DISPENSER));
@ -45,19 +38,6 @@ public class SchematicannonBlock extends Block {
return new SchematicannonTileEntity();
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
if (KeyboardHelper.isKeyDown(KeyboardHelper.LSHIFT)) {
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "Prints a deployed " + TextFormatting.BLUE + "Schematic"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "into the world using blocks from inventories"));
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "placed right next to it."));
} else
tooltip.add(new StringTextComponent(TextFormatting.DARK_GRAY + "< Hold Shift >"));
super.addInformation(stack, worldIn, tooltip, flagIn);
}
@Override
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
BlockPos currentPos, BlockPos facingPos) {
@ -85,7 +65,8 @@ public class SchematicannonBlock extends Block {
} else {
SchematicannonTileEntity te = (SchematicannonTileEntity) worldIn.getTileEntity(pos);
if (te != null)
if (AllItems.BLUEPRINT.typeOf(player.getHeldItemMainhand()) && te.inventory.getStackInSlot(0).isEmpty()) {
if (AllItems.BLUEPRINT.typeOf(player.getHeldItemMainhand())
&& te.inventory.getStackInSlot(0).isEmpty()) {
te.inventory.setStackInSlot(0, player.getHeldItemMainhand());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
}
@ -111,4 +92,11 @@ public class SchematicannonBlock extends Block {
}
@Override
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.");
}
}

View file

@ -7,7 +7,7 @@ import java.util.Map;
import com.simibubi.create.AllPackets;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.item.ItemWithToolTip;
import com.simibubi.create.foundation.item.InfoItem;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
@ -40,7 +40,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.PacketDistributor;
public class SymmetryWandItem extends ItemWithToolTip {
public class SymmetryWandItem extends InfoItem {
public static final String $SYMMETRY = "symmetry";
private static final String $ENABLE = "enable";
@ -50,7 +50,7 @@ public class SymmetryWandItem extends ItemWithToolTip {
}
@Override
protected ItemDescription getDescription() {
public ItemDescription getDescription() {
Palette palette = Palette.Purple;
return new ItemDescription(palette)
.withSummary("Perfectly mirrors your Block placement across the configured planes.")

View file

@ -0,0 +1,17 @@
{
"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 },
"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 }
}
}

View file

@ -23,7 +23,6 @@
"block.create.crushing_wheel": "Crushing Wheel",
"block.create.drill": "Mechanical Drill",
"block.create.harvester": "Mechanical Harvester",
"block.create.contact": "Redstone Contact",
"block.create.water_wheel": "Water Wheel",
"block.create.sticky_mechanical_piston": "Sticky Mechanical Piston",
@ -34,6 +33,11 @@
"block.create.sticky_construct": "Sticky Chassis",
"block.create.relocation_construct": "Relocation Chassis",
"block.create.contact": "Redstone Contact",
"block.create.redstone_bridge": "Redstone Bridge",
"block.create.stockpile_switch": "Stockpile Switch",
"block.create.flex_crate": "FlexCrate",
"block.create.andesite_bricks": "Andesite Bricks",
"block.create.diorite_bricks": "Diorite Bricks",
"block.create.granite_bricks": "Granite Bricks",

View file

@ -0,0 +1,57 @@
{
"__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": "#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 ] }
}
}
]
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/redstone_bridge",
"textures": {
"redstone_antenna": "create:block/redstone_antenna_powered",
"redstone_bridge": "create:block/redstone_bridge_powered"
}
}

View file

@ -0,0 +1,51 @@
{
"__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": "#redstone_bridge_side"
},
"elements": [
{
"name": "Controller",
"from": [ 3, 1, -1 ],
"to": [ 13, 15, 2 ],
"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 }
}
},
{
"name": "AntennaX",
"from": [ 3, 11, 2 ],
"to": [ 6, 21, 3 ],
"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": [ 4, 11, 1 ],
"to": [ 5, 21, 4 ],
"faces": {
"east": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] },
"west": { "texture": "#redstone_antenna", "uv": [ 0, 0, 3, 10 ] }
}
},
{
"name": "AntennaTop",
"from": [ 4, 19, 2 ],
"to": [ 5, 20, 3 ],
"faces": {
"up": { "texture": "#redstone_antenna", "uv": [ 1, 1, 2, 2 ] }
}
}
]
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/redstone_bridge_side",
"textures": {
"redstone_antenna": "create:block/redstone_antenna_powered",
"redstone_bridge_side": "create:block/redstone_bridge_side_powered"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/redstone_bridge_powered"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B