diff --git a/build.gradle b/build.gradle index 605b20a5e..d419f8f91 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: '20190910-1.14.3' + mappings channel: 'snapshot', version: '20190917-1.14.3' runs { client { @@ -34,7 +34,7 @@ minecraft { } server { - workingDirectory project.file('run') + workingDirectory project.file('run/server') property 'forge.logging.console.level', 'info' mods { create { @@ -71,7 +71,7 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.14.4-28.0.102' + minecraft 'net.minecraftforge:forge:1.14.4-28.1.6' // compile against the JEI API but do not include it at runtime compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.10:api") diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index d4e04920a..23c98f515 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -46,11 +46,11 @@ public enum AllItems { ANDESITE_ALLOY_CUBE(ingredient()), BLAZE_BRASS_CUBE(ingredient()), CHORUS_CHROME_CUBE(ingredient(Rarity.UNCOMMON)), - SHADOW_STEEL_CUBE(ingredient(Rarity.UNCOMMON)), - ROSE_QUARTZ(ingredient()), - REFINED_ROSE_QUARTZ(ingredient()), - CHROMATIC_COMPOUND_CUBE(new ChromaticCompoundCubeItem(standardItemProperties().rarity(Rarity.UNCOMMON))), - REFINED_RADIANCE_CUBE(ingredient(Rarity.RARE)), + SHADOW_STEEL_CUBE(new Item(new Properties().rarity(Rarity.UNCOMMON))), + ROSE_QUARTZ(new Item(new Properties())), + REFINED_ROSE_QUARTZ(new Item(new Properties())), + CHROMATIC_COMPOUND_CUBE(new ChromaticCompoundCubeItem(new Properties().rarity(Rarity.UNCOMMON))), + REFINED_RADIANCE_CUBE(new Item(new Properties().rarity(Rarity.UNCOMMON))), // BLAZING_PICKAXE(new BlazingToolItem(1, -2.8F, standardProperties(), PICKAXE)), // BLAZING_SHOVEL(new BlazingToolItem(1.5F, -3.0F, standardProperties(), SHOVEL)), diff --git a/src/main/java/com/simibubi/create/ClientEvents.java b/src/main/java/com/simibubi/create/ClientEvents.java index 07e0ed649..6a1514c99 100644 --- a/src/main/java/com/simibubi/create/ClientEvents.java +++ b/src/main/java/com/simibubi/create/ClientEvents.java @@ -109,6 +109,9 @@ public class ClientEvents { @SubscribeEvent public static void addToItemTooltip(ItemTooltipEvent event) { + if (!CreateClientConfig.instance.enableTooltips.get()) + return; + ItemStack stack = event.getItemStack(); String translationKey = stack.getItem().getTranslationKey(stack); if (!translationKey.startsWith(itemPrefix) && !translationKey.startsWith(blockPrefix)) diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 69fcfb0c4..ac61442de 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -39,7 +39,7 @@ public class Create { public static ModConfig config; public Create() { - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CreateConfig.specification); + ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, CreateConfig.specification); ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, CreateClientConfig.specification); } diff --git a/src/main/java/com/simibubi/create/CreateClientConfig.java b/src/main/java/com/simibubi/create/CreateClientConfig.java index 9384f5b31..e9dabe069 100644 --- a/src/main/java/com/simibubi/create/CreateClientConfig.java +++ b/src/main/java/com/simibubi/create/CreateClientConfig.java @@ -3,6 +3,7 @@ package com.simibubi.create; import org.apache.commons.lang3.tuple.Pair; import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; public class CreateClientConfig { @@ -17,8 +18,15 @@ public class CreateClientConfig { instance = specPair.getLeft(); } + public BooleanValue enableTooltips; + CreateClientConfig(final ForgeConfigSpec.Builder builder) { - builder.comment("Client-only settings").push("client"); + builder.comment("Client-only settings - If you're looking for server/common settings, look inside your worlds serverconfig folder!").push("client"); + String basePath = "create.config.client."; + + String name = "enableTooltips"; + enableTooltips = builder.comment("", "Show item descriptions on Shift and controls on Ctrl.") + .translation(basePath + name).define(name, true); builder.pop(); } diff --git a/src/main/java/com/simibubi/create/foundation/block/IBlockWithScrollableValue.java b/src/main/java/com/simibubi/create/foundation/block/IBlockWithScrollableValue.java index 62fac0142..be4266385 100644 --- a/src/main/java/com/simibubi/create/foundation/block/IBlockWithScrollableValue.java +++ b/src/main/java/com/simibubi/create/foundation/block/IBlockWithScrollableValue.java @@ -46,6 +46,10 @@ public interface IBlockWithScrollableValue { return false; } + public default String getValueSuffix(BlockState state, IWorld world, BlockPos pos) { + return ""; + } + @SubscribeEvent @OnlyIn(Dist.CLIENT) public static void onDrawBlockHighlight(DrawBlockHighlightEvent event) { @@ -141,12 +145,18 @@ public interface IBlockWithScrollableValue { GlStateManager.popMatrix(); } - String numberText = block.getCurrentValue(state, world, blockPos) + ""; + String numberText = block.getCurrentValue(state, world, blockPos) + + block.getValueSuffix(state, world, blockPos); int stringWidth = mc.fontRenderer.getStringWidth(numberText); - float numberScale = 4 / 128f * (6f / stringWidth); - GlStateManager.translated(7 / 64f, -5 / 64f, 0); + float numberScale = 4 / 128f * ((float) mc.fontRenderer.FONT_HEIGHT / stringWidth); + boolean singleDigit = stringWidth < 10; + if (singleDigit) + numberScale = numberScale / 2; + GlStateManager.translated(4 / 64f, -5 / 64f, 0); GlStateManager.scaled(numberScale, -numberScale, numberScale); + float verticalMargin = (stringWidth - mc.fontRenderer.FONT_HEIGHT) / 2f; + GlStateManager.translated(singleDigit ? stringWidth / 2 : 0, singleDigit ? -verticalMargin : verticalMargin, 0); mc.fontRenderer.drawString(numberText, 0, 0, 0xFFFFFF); GlStateManager.translated(0, 0, -1 / 4f); diff --git a/src/main/java/com/simibubi/create/foundation/item/IItemWithColorHandler.java b/src/main/java/com/simibubi/create/foundation/item/IItemWithColorHandler.java index 7accd3c7e..f247737ff 100644 --- a/src/main/java/com/simibubi/create/foundation/item/IItemWithColorHandler.java +++ b/src/main/java/com/simibubi/create/foundation/item/IItemWithColorHandler.java @@ -1,9 +1,12 @@ package com.simibubi.create.foundation.item; import net.minecraft.client.renderer.color.IItemColor; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public interface IItemWithColorHandler { + @OnlyIn(value = Dist.CLIENT) public IItemColor getColorHandler(); } diff --git a/src/main/java/com/simibubi/create/modules/ModuleLoadedCondition.java b/src/main/java/com/simibubi/create/modules/ModuleLoadedCondition.java index aa7016d98..85989685e 100644 --- a/src/main/java/com/simibubi/create/modules/ModuleLoadedCondition.java +++ b/src/main/java/com/simibubi/create/modules/ModuleLoadedCondition.java @@ -44,7 +44,7 @@ public class ModuleLoadedCondition implements ICondition { public ModuleLoadedCondition read(JsonObject json) { return new ModuleLoadedCondition(JSONUtils.getString(json, "module")); } - + @Override public ResourceLocation getID() { return NAME; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/RotationPropagator.java b/src/main/java/com/simibubi/create/modules/contraptions/RotationPropagator.java index f635e2330..ba76a2a65 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/RotationPropagator.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/RotationPropagator.java @@ -1,6 +1,11 @@ package com.simibubi.create.modules.contraptions; +import static com.simibubi.create.AllBlocks.BELT; +import static com.simibubi.create.AllBlocks.COGWHEEL; +import static com.simibubi.create.AllBlocks.ENCASED_FAN; +import static com.simibubi.create.AllBlocks.LARGE_COGWHEEL; import static com.simibubi.create.CreateConfig.parameters; +import static net.minecraft.state.properties.BlockStateProperties.AXIS; import java.util.LinkedList; import java.util.List; @@ -15,8 +20,6 @@ import com.simibubi.create.modules.contraptions.relays.SplitShaftTileEntity; import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity; import net.minecraft.block.BlockState; -import net.minecraft.state.IProperty; -import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; @@ -42,7 +45,6 @@ public class RotationPropagator { final Direction direction = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ()); final World world = from.getWorld(); - IProperty axisProperty = BlockStateProperties.AXIS; boolean connectedByAxis = definitionFrom.hasShaftTowards(world, from.getPos(), stateFrom, direction) && definitionTo.hasShaftTowards(world, to.getPos(), stateTo, direction.getOpposite()); boolean connectedByGears = definitionFrom.hasCogsTowards(world, from.getPos(), stateFrom, direction) @@ -71,11 +73,21 @@ public class RotationPropagator { } // Attached Fans - if (AllBlocks.ENCASED_FAN.typeOf(stateFrom) && AllBlocks.ENCASED_FAN.typeOf(stateTo)) { - if (stateFrom.get(BlockStateProperties.AXIS) == stateTo.get(BlockStateProperties.AXIS)) + if (ENCASED_FAN.typeOf(stateFrom) && ENCASED_FAN.typeOf(stateTo)) { + if (stateFrom.get(AXIS) == stateTo.get(AXIS)) return 1; } + // Large Gear <-> Large Gear + if (isLargeToLargeGear(stateFrom, stateTo, diff)) { + Axis sourceAxis = stateFrom.get(AXIS); + Axis targetAxis = stateTo.get(AXIS); + int sourceAxisDiff = sourceAxis.getCoordinate(diff.getX(), diff.getY(), diff.getZ()); + int targetAxisDiff = targetAxis.getCoordinate(diff.getX(), diff.getY(), diff.getZ()); + + return sourceAxisDiff > 0 ^ targetAxisDiff > 0 ? -1 : 1; + } + // Gear <-> Large Gear if (isLargeToSmallGear(stateFrom, stateTo, diff)) return -2f; @@ -86,15 +98,34 @@ public class RotationPropagator { if (connectedByGears) { if (diff.manhattanDistance(BlockPos.ZERO) != 1) return 0; - if (AllBlocks.LARGE_COGWHEEL.typeOf(stateTo)) + if (LARGE_COGWHEEL.typeOf(stateTo)) return 0; - if (stateFrom.get(axisProperty) == stateTo.get(axisProperty)) + if (stateFrom.get(AXIS) == stateTo.get(AXIS)) return -1; } return 0; } + private static boolean isLargeToLargeGear(BlockState from, BlockState to, BlockPos diff) { + if (!LARGE_COGWHEEL.typeOf(from) || !LARGE_COGWHEEL.typeOf(to)) + return false; + Axis fromAxis = from.get(AXIS); + Axis toAxis = to.get(AXIS); + if (fromAxis == toAxis) + return false; + for (Axis axis : Axis.values()) { + int axisDiff = axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ()); + if (axis == fromAxis || axis == toAxis) { + if (axisDiff == 0) + return false; + + } else if (axisDiff != 0) + return false; + } + return true; + } + private static float getAxisModifier(KineticTileEntity te, Direction direction) { if (!te.hasSource()) return 1; @@ -111,10 +142,10 @@ public class RotationPropagator { } private static boolean isLargeToSmallGear(BlockState from, BlockState to, final BlockPos diff) { - if (!AllBlocks.LARGE_COGWHEEL.typeOf(from) || !AllBlocks.COGWHEEL.typeOf(to)) + if (!LARGE_COGWHEEL.typeOf(from) || !COGWHEEL.typeOf(to)) return false; - Axis axisFrom = from.get(BlockStateProperties.AXIS); - if (axisFrom != to.get(BlockStateProperties.AXIS)) + Axis axisFrom = from.get(AXIS); + if (axisFrom != to.get(AXIS)) return false; if (axisFrom.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) != 0) return false; @@ -309,12 +340,13 @@ public class RotationPropagator { // Some Blocks can interface diagonally BlockState blockState = te.getBlockState(); - if (AllBlocks.COGWHEEL.typeOf(blockState) || AllBlocks.LARGE_COGWHEEL.typeOf(blockState) - || AllBlocks.BELT.typeOf(blockState)) { + boolean isLargeWheel = LARGE_COGWHEEL.typeOf(blockState); + + if (COGWHEEL.typeOf(blockState) || isLargeWheel || BELT.typeOf(blockState)) { Axis axis = ((IRotate) blockState.getBlock()).getRotationAxis(blockState); BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)).forEach(offset -> { - if (axis.getCoordinate(offset.getX(), offset.getY(), offset.getZ()) != 0) + if (!isLargeWheel && axis.getCoordinate(offset.getX(), offset.getY(), offset.getZ()) != 0) return; if (offset.distanceSq(0, 0, 0, false) != BlockPos.ZERO.distanceSq(1, 1, 0, false)) return; @@ -324,7 +356,7 @@ public class RotationPropagator { return neighbours; } - + public static boolean isFrozen() { return CreateConfig.parameters.freezeRotationPropagator.get(); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/ProcessingRecipeSerializer.java b/src/main/java/com/simibubi/create/modules/contraptions/base/ProcessingRecipeSerializer.java index d6cc2e9c8..349fcc6da 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/ProcessingRecipeSerializer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/ProcessingRecipeSerializer.java @@ -42,7 +42,7 @@ public class ProcessingRecipeSerializer> ItemStack itemstack = new ItemStack(Registry.ITEM.getOrDefault(new ResourceLocation(s1)), i); results.add(new StochasticOutput(itemstack, chance)); } - + int duration = JSONUtils.getInt(json, "processingTime"); return this.factory.create(recipeId, s, ingredients, results, duration); @@ -52,13 +52,15 @@ public class ProcessingRecipeSerializer> String s = buffer.readString(32767); List ingredients = new ArrayList<>(); - for (int i = 0; i < buffer.readInt(); i++) + int ingredientCount = buffer.readInt(); + for (int i = 0; i < ingredientCount; i++) ingredients.add(Ingredient.read(buffer)); - + List results = new ArrayList<>(); - for (int i = 0; i < buffer.readInt(); i++) + int outputCount = buffer.readInt(); + for (int i = 0; i < outputCount; i++) results.add(StochasticOutput.read(buffer)); - + int duration = buffer.readInt(); return this.factory.create(recipeId, s, ingredients, results, duration); @@ -72,12 +74,13 @@ public class ProcessingRecipeSerializer> buffer.writeInt(recipe.getRollableResults().size()); recipe.getRollableResults().forEach(i -> i.write(buffer)); - + buffer.writeInt(recipe.processingDuration); } public interface IRecipeFactory> { - T create(ResourceLocation id, String group, List ingredients, List results, int duration); + T create(ResourceLocation id, String group, List ingredients, List results, + int duration); } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorBlock.java index 6e0d0074e..372074139 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorBlock.java @@ -76,7 +76,8 @@ public class MotorBlock extends HorizontalKineticBlock @Override public void onScroll(BlockState state, IWorld world, BlockPos pos, double delta) { - withTileEntityDo(world, pos, te -> te.setSpeedValueLazily((int) (te.getSpeedValue() * (delta > 0 ? 2 : .5f)))); + withTileEntityDo(world, pos, te -> te + .setSpeedValueLazily((int) (te.getSpeedValue() * (delta > 0 ^ te.getSpeedValue() < 0 ? 2 : .5f)))); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorTileEntity.java index 1dad6d68c..d1519b2cb 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorTileEntity.java @@ -44,7 +44,13 @@ public class MotorTileEntity extends KineticTileEntity implements ITickableTileE public void setSpeedValueLazily(int speed) { if (newSpeed == speed) return; - newSpeed = MathHelper.clamp(speed, 1, CreateConfig.parameters.maxMotorSpeed.get()); + Integer max = CreateConfig.parameters.maxMotorSpeed.get(); + if (newSpeed > 0 && speed == 0) + newSpeed = -1; + else if (newSpeed < 0 && speed == 0) + newSpeed = 1; + else + newSpeed = MathHelper.clamp(speed, -max, max); this.lastModified = 0; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerBlock.java index 6e5c72d47..33e6866f3 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerBlock.java @@ -36,7 +36,7 @@ public class CrushingWheelControllerBlock extends Block implements IWithoutBlock @Override public boolean hasTileEntity(BlockState state) { - return state.get(VALID); + return true; } @Override @@ -95,11 +95,17 @@ public class CrushingWheelControllerBlock extends Block implements IWithoutBlock } public void updateSpeed(BlockState state, World world, BlockPos pos) { - if (!state.get(VALID) || CrushingWheelControllerTileEntity.isFrozen()) - return; CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) world.getTileEntity(pos); + if (te == null) return; + if (!state.get(VALID) || CrushingWheelControllerTileEntity.isFrozen()) { + if (te.crushingspeed != 0) { + te.crushingspeed = 0; + te.sendData(); + } + return; + } for (Direction d : Direction.values()) { if (d.getAxis().isVertical()) @@ -111,6 +117,7 @@ public class CrushingWheelControllerBlock extends Block implements IWithoutBlock continue; KineticTileEntity wheelTe = (KineticTileEntity) world.getTileEntity(pos.offset(d)); te.crushingspeed = Math.abs(wheelTe.getSpeed() / 50f); + te.sendData(); break; } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerTileEntity.java index 1652efcd8..a53797607 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerTileEntity.java @@ -81,6 +81,7 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen public Entity processingEntity; private UUID entityUUID; + protected boolean searchForEntity; private Inventory contents; public float crushingspeed; @@ -92,9 +93,23 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen @Override public void tick() { - if (!isOccupied() || isFrozen()) + if (isFrozen()) return; - + if (searchForEntity) { + searchForEntity = false; + List search = world.getEntitiesInAABBexcluding(null, new AxisAlignedBB(getPos()), + e -> entityUUID.equals(e.getUniqueID())); + if (search.isEmpty()) + clear(); + else + processingEntity = search.get(0); + } + + if (!isOccupied()) + return; + if (crushingspeed == 0) + return; + float speed = crushingspeed / 2.5f; if (!hasEntity()) { @@ -216,15 +231,9 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen public void read(CompoundNBT compound) { super.read(compound); - if (compound.contains("Entity") && !isFrozen()) { + if (compound.contains("Entity") && !isFrozen() && !isOccupied()) { entityUUID = NBTUtil.readUniqueId(compound.getCompound("Entity")); - - List search = world.getEntitiesInAABBexcluding(null, new AxisAlignedBB(getPos()), - e -> entityUUID.equals(e.getUniqueID())); - if (search.isEmpty()) - clear(); - else - processingEntity = search.get(0); + this.searchForEntity = true; } crushingspeed = compound.getFloat("Speed"); contents = Inventory.read(compound); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingTileEntity.java index 42c08a792..05819b281 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingTileEntity.java @@ -15,6 +15,8 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.gen.feature.template.Template.BlockInfo; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class MechanicalBearingTileEntity extends KineticTileEntity implements ITickableTileEntity { @@ -33,6 +35,12 @@ public class MechanicalBearingTileEntity extends KineticTileEntity implements IT public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } + + @Override + @OnlyIn(Dist.CLIENT) + public double getMaxRenderDistanceSquared() { + return super.getMaxRenderDistanceSquared() * 16; + } @Override public boolean isSource() { @@ -47,7 +55,7 @@ public class MechanicalBearingTileEntity extends KineticTileEntity implements IT isWindmill = shouldWindmill; if (isWindmill) removeSource(); - + if (isWindmill && !running) { assembleNextTick = true; } @@ -177,7 +185,8 @@ public class MechanicalBearingTileEntity extends KineticTileEntity implements IT if (!world.isRemote && assembleNextTick) { assembleNextTick = false; if (running) { - if (speed == 0 && (Math.abs(angle) < Math.PI / 4f || Math.abs(angle) > 7 * Math.PI / 4f)) { + boolean canDisassemble = Math.abs(angle) < Math.PI / 4f || Math.abs(angle) > 7 * Math.PI / 4f; + if (speed == 0 && (canDisassemble || movingConstruct == null || movingConstruct.blocks.isEmpty())) { disassembleConstruct(); } return; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalPistonTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalPistonTileEntity.java index 9e3cd501b..36d75fd8f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalPistonTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalPistonTileEntity.java @@ -24,6 +24,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.gen.feature.template.Template.BlockInfo; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class MechanicalPistonTileEntity extends KineticTileEntity implements ITickableTileEntity { @@ -55,6 +57,12 @@ public class MechanicalPistonTileEntity extends KineticTileEntity implements ITi public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } + + @Override + @OnlyIn(Dist.CLIENT) + public double getMaxRenderDistanceSquared() { + return super.getMaxRenderDistanceSquared() * 16; + } @Override public CompoundNBT write(CompoundNBT tag) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/TranslationConstruct.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/TranslationConstruct.java index 311cc9774..7250a6e25 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/TranslationConstruct.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/TranslationConstruct.java @@ -22,6 +22,7 @@ import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalP import net.minecraft.block.BlockState; import net.minecraft.block.FallingBlock; import net.minecraft.block.PistonBlock; +import net.minecraft.block.ShulkerBoxBlock; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.FloatNBT; import net.minecraft.nbt.ListNBT; @@ -81,7 +82,7 @@ public class TranslationConstruct { public static TranslationConstruct getAttachedForPushing(World world, BlockPos pos, Direction direction) { if (isFrozen()) return null; - + TranslationConstruct construct = new TranslationConstruct(); if (!construct.collectExtensions(world, pos, direction)) @@ -96,7 +97,7 @@ public class TranslationConstruct { public static TranslationConstruct getAttachedForPulling(World world, BlockPos pos, Direction direction) { if (isFrozen()) return null; - + TranslationConstruct construct = new TranslationConstruct(); if (!construct.collectExtensions(world, pos, direction)) @@ -120,12 +121,12 @@ public class TranslationConstruct { if (world.getBlockState(pos).get(MechanicalPistonBlock.STATE) == PistonState.EXTENDED) { while (PISTON_POLE.typeOf(nextBlock) && nextBlock.get(FACING).getAxis() == direction.getAxis() || MECHANICAL_PISTON_HEAD.typeOf(nextBlock) && nextBlock.get(FACING) == direction) { - + actualStart = actualStart.offset(direction); poles.add(new BlockInfo(actualStart, nextBlock.with(FACING, direction), null)); extensionsInFront++; nextBlock = world.getBlockState(actualStart.offset(direction)); - + if (extensionsInFront > parameters.maxPistonPoles.get()) return false; } @@ -184,7 +185,7 @@ public class TranslationConstruct { if (state.getCollisionShape(world, pos.offset(direction)).isEmpty()) return true; if (!canPull(world, pos.offset(direction), movementDirection)) - return false; + return true; BlockPos blockPos = pos.offset(direction).offset(direction, -offset); blocks.put(blockPos, new BlockInfo(blockPos, state, null)); @@ -260,8 +261,9 @@ public class TranslationConstruct { axis == Axis.Y ? chassisCoord : pos.getY(), axis == Axis.Z ? chassisCoord : pos.getZ()); List blocks = new ArrayList<>(); + boolean pushing = direction == movementDirection; - while (!frontier.isEmpty()) { + Search: while (!frontier.isEmpty()) { BlockPos currentPos = frontier.remove(0); BlockState state = world.getBlockState(currentPos); @@ -287,27 +289,26 @@ public class TranslationConstruct { continue; // Too many Blocks - if (direction == movementDirection && !currentChassisPos.withinDistance(currentPos, chassisRange + 1)) + if (pushing && !currentChassisPos.withinDistance(currentPos, chassisRange + 1)) return null; if (direction != movementDirection && !currentChassisPos.withinDistance(currentPos, chassisRange + 1)) continue; // Skip if pushed column ended already (Except for Relocating Chassis) - if (!chassisSticky && !currentPos.equals(currentChassisPos)) { - boolean skip = false; - - if (movementDirection != direction && !currentChassisPos.withinDistance(currentPos, 1)) - continue; - + if (!currentPos.equals(currentChassisPos)) { for (BlockPos p = currentPos; !p.equals(currentChassisPos); p = p.offset(direction.getOpposite())) { - if (world.getBlockState(p).getMaterial().isReplaceable() - || world.getBlockState(p).isAir(world, currentPos)) { - skip = true; - break; + BlockState blockState = world.getBlockState(p); + + if (!chassisSticky && (blockState.getMaterial().isReplaceable() + || blockState.isAir(world, currentPos))) { + continue Search; } + + if (!pushing && chassisSticky && !canPush(world, p, movementDirection)) { + continue Search; + } + } - if (skip) - continue; } // Ignore sand and co. @@ -315,14 +316,17 @@ public class TranslationConstruct { continue; // Structure is immobile - if (!canPush(world, currentPos, movementDirection)) + if (pushing && !canPush(world, currentPos, movementDirection)) return null; + if (!pushing && !canPull(world, currentPos, movementDirection)) + continue; CompoundNBT nbt = new CompoundNBT(); nbt.putInt("Range", chassisRange); - blocks.add(new BlockInfo(currentPos.offset(direction, -offset), state, AllBlocks.TRANSLATION_CHASSIS.typeOf(state) ? nbt : null)); + + // Expand search for (Direction facing : Direction.values()) { if (currentChassisPos.equals(currentPos) && facing == direction.getOpposite()) continue; @@ -337,12 +341,16 @@ public class TranslationConstruct { } private static boolean canPush(World world, BlockPos pos, Direction direction) { - return PistonBlock.canPush(world.getBlockState(pos), world, pos, direction, true, direction) - || AllBlocks.TRANSLATION_CHASSIS.typeOf(world.getBlockState(pos)); + BlockState blockState = world.getBlockState(pos); + if (AllBlocks.TRANSLATION_CHASSIS.typeOf(blockState)) + return true; + if (blockState.getBlock() instanceof ShulkerBoxBlock) + return false; + return PistonBlock.canPush(blockState, world, pos, direction, true, direction); } private static boolean canPull(World world, BlockPos pos, Direction direction) { - return PistonBlock.canPush(world.getBlockState(pos), world, pos, direction, true, direction.getOpposite()); + return canPush(world, pos, direction.getOpposite()); } private static List collectChassis(World world, BlockPos pos, Direction direction, int offset2) { @@ -454,7 +462,7 @@ public class TranslationConstruct { return construct; } - + public static boolean isFrozen() { return CreateConfig.parameters.freezePistonConstructs.get(); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java index 3251ab5a1..3c172886e 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java @@ -155,13 +155,13 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn passengers.forEach((entity, info) -> { if (!canTransport(entity)) toRemove.add(entity); - if (info.ticksSinceLastCollision > 1) { + if (info.ticksSinceLastCollision > ((getBlockState().get(BeltBlock.SLOPE) != Slope.HORIZONTAL) ? 3 : 1)) { toRemove.add(entity); } info.tick(); }); toRemove.forEach(e -> { - if (e instanceof ItemEntity && ((ItemEntity) e).getAge() < 0) + if (e instanceof ItemEntity) ((ItemEntity) e).setAgeToCreativeDespawnTime(); passengers.remove(e); }); @@ -187,18 +187,22 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn return; } - if (speed == 0) + // Too slow + boolean notHorizontal = getBlockState().get(BeltBlock.SLOPE) != Slope.HORIZONTAL; + if (Math.abs(getSpeed()) < (notHorizontal ? 32 : 1)) return; + // Not on top if (entityIn.posY - .25f < pos.getY()) return; - if (entityIn instanceof LivingEntity) { + // Not sure if this does anything + if (entityIn instanceof LivingEntity) ((LivingEntity) entityIn).setIdleTime(101); - } BeltTileEntity belt = (BeltTileEntity) te; + // Attachment pauses movement for (BeltAttachmentState state : belt.attachmentTracker.attachments) { if (state.attachment.handleEntity(belt, entityIn, state)) { info.ticksSinceLastCollision--; @@ -218,15 +222,15 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn Vec3d movement = new Vec3d(movementDirection.getDirectionVec()).scale(movementSpeed); double diffCenter = axis == Axis.Z ? (pos.getX() + .5f - entityIn.posX) : (pos.getZ() + .5f - entityIn.posZ); - float maxDiffCenter = (entityIn instanceof ItemEntity)? 32 / 64f : 48 / 64f; + float maxDiffCenter = (entityIn instanceof ItemEntity) ? 32 / 64f : 48 / 64f; if (Math.abs(diffCenter) > maxDiffCenter) return; Part part = blockState.get(BeltBlock.PART); float top = 13 / 16f; - boolean onSlope = part == Part.MIDDLE + boolean onSlope = notHorizontal && (part == Part.MIDDLE || part == (slope == Slope.UPWARD ? Part.END : Part.START) && entityIn.posY - pos.getY() < top - || part == (slope == Slope.UPWARD ? Part.START : Part.END) && entityIn.posY - pos.getY() > top; + || part == (slope == Slope.UPWARD ? Part.START : Part.END) && entityIn.posY - pos.getY() > top); boolean movingDown = onSlope && slope == (movementFacing == beltFacing ? Slope.DOWNWARD : Slope.UPWARD); boolean movingUp = onSlope && slope == (movementFacing == beltFacing ? Slope.UPWARD : Slope.DOWNWARD); @@ -246,8 +250,10 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn movement = movement.add(centering); float step = entityIn.stepHeight; - entityIn.stepHeight = 1; + if (!(entityIn instanceof PlayerEntity)) + entityIn.stepHeight = 1; + // Entity Collisions if (Math.abs(movementSpeed) < .5f) { Vec3d checkDistance = movement.scale(2f).add(movement.normalize()); AxisAlignedBB bb = entityIn.getBoundingBox(); @@ -264,7 +270,7 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn if (movingUp) { float minVelocity = entityIn instanceof ItemEntity ? .09f : .13f; - float yMovement = (float) (Math.signum(movementSpeed) * Math.max(Math.abs(movement.y), minVelocity)); + float yMovement = (float) -(Math.max(Math.abs(movement.y), minVelocity)); entityIn.move(MoverType.SELF, new Vec3d(0, yMovement, 0)); entityIn.move(MoverType.SELF, movement.mul(1, 0, 1)); } else if (movingDown) { @@ -273,15 +279,17 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn } else { entityIn.move(MoverType.SELF, movement); } - entityIn.stepHeight = step; - boolean movedPastEndingSlope = onSlope && AllBlocks.BELT.typeOf(world.getBlockState(entityIn.getPosition())) - || AllBlocks.BELT.typeOf(world.getBlockState(entityIn.getPosition().down())); + if (!(entityIn instanceof PlayerEntity)) + entityIn.stepHeight = step; - if (movedPastEndingSlope && !movingDown && Math.abs(movementSpeed) > .25f) { + boolean movedPastEndingSlope = onSlope && (AllBlocks.BELT.typeOf(world.getBlockState(entityIn.getPosition())) + || AllBlocks.BELT.typeOf(world.getBlockState(entityIn.getPosition().down()))); + + if (movedPastEndingSlope && !movingDown && Math.abs(movementSpeed) > 0) entityIn.setPosition(entityIn.posX, entityIn.posY + movement.y, entityIn.posZ); + if (movedPastEndingSlope) entityIn.setMotion(movement); - } } public boolean canTransport(Entity entity) { diff --git a/src/main/java/com/simibubi/create/modules/curiosities/ChromaticCompoundCubeItem.java b/src/main/java/com/simibubi/create/modules/curiosities/ChromaticCompoundCubeItem.java index 4c3422dd9..570028466 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/ChromaticCompoundCubeItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/ChromaticCompoundCubeItem.java @@ -8,10 +8,13 @@ import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.animation.Animation; public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHandler { + @OnlyIn(value = Dist.CLIENT) public static class Color implements IItemColor { @Override public int getColor(ItemStack stack, int layer) { @@ -36,6 +39,7 @@ public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHan } @Override + @OnlyIn(value = Dist.CLIENT) public IItemColor getColorHandler() { return new Color(); } diff --git a/src/main/java/com/simibubi/create/modules/logistics/FrequencyHandler.java b/src/main/java/com/simibubi/create/modules/logistics/FrequencyHandler.java index 7f06a89dd..97db6644a 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/FrequencyHandler.java +++ b/src/main/java/com/simibubi/create/modules/logistics/FrequencyHandler.java @@ -63,7 +63,7 @@ public class FrequencyHandler { } public List getNetworkOf(IHaveWireless actor) { - Map, List> networksInWorld = networksIn(actor.getWorld()); + Map, List> networksInWorld = networksIn(actor.getWirelessWorld()); Pair key = getNetworkKey(actor); if (!networksInWorld.containsKey(key)) networksInWorld.put(key, new ArrayList<>()); @@ -79,7 +79,7 @@ public class FrequencyHandler { List network = getNetworkOf(actor); network.remove(actor); if (network.isEmpty()) { - networksIn(actor.getWorld()).remove(getNetworkKey(actor)); + networksIn(actor.getWirelessWorld()).remove(getNetworkKey(actor)); return; } updateNetworkOf(actor); @@ -109,7 +109,7 @@ public class FrequencyHandler { } public static boolean withinRange(IHaveWireless from, IHaveWireless to) { - return from.getPos().withinDistance(to.getPos(), CreateConfig.parameters.linkRange.get()); + return from.getWirelessPos().withinDistance(to.getWirelessPos(), CreateConfig.parameters.linkRange.get()); } public Map, List> networksIn(IWorld world) { diff --git a/src/main/java/com/simibubi/create/modules/logistics/IHaveWireless.java b/src/main/java/com/simibubi/create/modules/logistics/IHaveWireless.java index 45fbe124b..98045246e 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/IHaveWireless.java +++ b/src/main/java/com/simibubi/create/modules/logistics/IHaveWireless.java @@ -4,6 +4,7 @@ import com.simibubi.create.Create; import com.simibubi.create.modules.logistics.FrequencyHandler.Frequency; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -12,12 +13,19 @@ public interface IHaveWireless { public Frequency getFrequencyFirst(); public Frequency getFrequencyLast(); public void setFrequency(boolean first, ItemStack stack); - public World getWorld(); - public BlockPos getPos(); + + public default World getWirelessWorld() { + return ((TileEntity) this).getWorld(); + } + + public default BlockPos getWirelessPos() { + return ((TileEntity) this).getPos(); + } public default boolean isLoaded() { - return getWorld().isBlockPresent(getPos()); + return getWirelessWorld().isBlockPresent(getWirelessPos()); } + default FrequencyHandler getHandler() { return Create.frequencyHandler; } diff --git a/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java b/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java index 0da160b30..47d1400c6 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java +++ b/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java @@ -42,8 +42,8 @@ public class InWorldProcessing { public static boolean canProcess(ItemEntity entity, Type type) { World world = entity.world; - if (entity.getPersistantData().contains("CreateData") - && entity.getPersistantData().getCompound("CreateData").contains("Processing")) + if (entity.getPersistentData().contains("CreateData") + && entity.getPersistentData().getCompound("CreateData").contains("Processing")) return true; if (type == Type.BLASTING) { @@ -124,7 +124,7 @@ public class InWorldProcessing { } private static int decrementProcessingTime(ItemEntity entity, Type type) { - CompoundNBT nbt = entity.getPersistantData(); + CompoundNBT nbt = entity.getPersistentData(); if (!nbt.contains("CreateData")) nbt.put("CreateData", new CompoundNBT()); @@ -178,8 +178,11 @@ public class InWorldProcessing { return; } entity.setItem(stacks.remove(0)); - for (ItemStack additional : stacks) - entity.world.addEntity(new ItemEntity(entity.world, entity.posX, entity.posY, entity.posZ, additional)); + for (ItemStack additional : stacks) { + ItemEntity entityIn = new ItemEntity(entity.world, entity.posX, entity.posY, entity.posZ, additional); + entityIn.setMotion(entity.getMotion()); + entity.world.addEntity(entityIn); + } } public static boolean isFrozen() { diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/BeltFunnelTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/BeltFunnelTileEntity.java index dbc55795f..d568c2ef2 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/BeltFunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/BeltFunnelTileEntity.java @@ -69,7 +69,7 @@ public class BeltFunnelTileEntity extends SyncedTileEntity implements ITickableT initialize = false; } } - + @Override public void setInventory(LazyOptional inventory) { this.inventory = inventory; diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/IInventoryManipulator.java b/src/main/java/com/simibubi/create/modules/logistics/block/IInventoryManipulator.java index 944d95f0a..693c030e0 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/IInventoryManipulator.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/IInventoryManipulator.java @@ -10,9 +10,13 @@ import net.minecraftforge.items.IItemHandler; public interface IInventoryManipulator { - public World getWorld(); - - public BlockPos getPos(); + public default World getWorld() { + return ((TileEntity) this).getWorld(); + } + + public default BlockPos getPos() { + return ((TileEntity) this).getPos(); + } public BlockPos getInventoryPos(); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/LinkedExtractorTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/LinkedExtractorTileEntity.java index bcd28b14c..d2badee55 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/LinkedExtractorTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/LinkedExtractorTileEntity.java @@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; @@ -37,6 +38,11 @@ public class LinkedExtractorTileEntity extends LinkedTileEntity super.onLoad(); initialize = true; } + + @Override + public World getWirelessWorld() { + return super.getWorld(); + } @Override public void setSignal(boolean powered) { diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java index fa484cb95..9abbb3d76 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java @@ -84,7 +84,15 @@ public class FlexpeaterBlock extends RedstoneDiodeBlock FlexpeaterTileEntity te = (FlexpeaterTileEntity) world.getTileEntity(pos); if (te == null) return ""; - return Lang.translate("generic.delay") + " (" + te.getUnit() + ")"; + return Lang.translate("generic.delay") + " (" + Lang.translate("generic.unit." + te.getUnit()) + ")"; + } + + @Override + public String getValueSuffix(BlockState state, IWorld world, BlockPos pos) { + FlexpeaterTileEntity te = (FlexpeaterTileEntity) world.getTileEntity(pos); + if (te == null) + return ""; + return "" + te.getUnit().charAt(0); } @Override diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntity.java index 25f7053d3..423ae1436 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntity.java @@ -6,7 +6,6 @@ import static net.minecraft.block.RedstoneDiodeBlock.POWERED; import com.simibubi.create.AllPackets; import com.simibubi.create.AllTileEntities; import com.simibubi.create.foundation.block.SyncedTileEntity; -import com.simibubi.create.foundation.utility.Lang; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; @@ -25,7 +24,7 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT lastModified = -1; maxState = 1; } - + @Override public void read(CompoundNBT compound) { state = compound.getInt("State"); @@ -34,7 +33,7 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT lastModified = -1; super.read(compound); } - + @Override public CompoundNBT write(CompoundNBT compound) { compound.putInt("State", state); @@ -55,7 +54,7 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT } lastModified = 0; } - + if (amount < 0) { if (newMaxState <= 20) { newMaxState += amount; @@ -69,7 +68,7 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT newMaxState = MathHelper.clamp(newMaxState, 1, 60 * 20 * 30); } - + @Override public boolean hasFastRenderer() { return true; @@ -85,12 +84,12 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT public String getUnit() { if (newMaxState < 20) - return Lang.translate("generic.unit.ticks"); + return "ticks"; if (newMaxState < 20 * 60) - return Lang.translate("generic.unit.seconds"); - return Lang.translate("generic.unit.minutes"); + return "seconds"; + return "minutes"; } - + @Override public void tick() { updateConfigurableValue(); @@ -98,10 +97,10 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT boolean powering = getBlockState().get(POWERING); boolean atMax = state == maxState; boolean atMin = state == 0; - + if (!charging && powered) charging = true; - + if (charging && atMax) { if (!powering && !world.isRemote) world.setBlockState(pos, getBlockState().with(POWERING, true)); @@ -109,13 +108,13 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT charging = false; return; } - + if (!charging && atMin) { if (powering && !world.isRemote) world.setBlockState(pos, getBlockState().with(POWERING, false)); return; } - + state += charging ? 1 : -1; } diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java index e039f314d..eec8e7a55 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java @@ -656,6 +656,8 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka protected boolean shouldIgnoreBlockState(BlockState state) { // Block doesnt have a mapping (Water, lava, etc) + if (state.getBlock() == Blocks.STRUCTURE_VOID) + return true; if (getItemForBlock(state).getItem() == Items.AIR && state.getBlock() != Blocks.AIR) return true; diff --git a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicHandler.java b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicHandler.java index 2eaba818c..b455dad32 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicHandler.java +++ b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicHandler.java @@ -213,7 +213,7 @@ public class SchematicHandler { PlacementSettings settings = cachedSettings.copy(); settings.setBoundingBox(null); schematic.addBlocksToWorld(w, anchor, settings); - new SchematicHologram().startHologram(w); + CreateClient.schematicHologram.startHologram(w); } } diff --git a/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java b/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java index 7aa90004a..4cdb611de 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java +++ b/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java @@ -12,6 +12,7 @@ import org.apache.commons.io.IOUtils; import com.simibubi.create.AllItems; import com.simibubi.create.CreateConfig; import com.simibubi.create.foundation.gui.ScreenOpener; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.schematics.client.SchematicEditScreen; import net.minecraft.client.util.ITooltipFlag; @@ -67,6 +68,8 @@ public class SchematicItem extends Item { if (stack.hasTag()) { if (stack.getTag().contains("File")) tooltip.add(new StringTextComponent(TextFormatting.GOLD + stack.getTag().getString("File"))); + } else { + tooltip.add(new StringTextComponent(TextFormatting.RED + Lang.translate("schematic.invalid"))); } super.addInformation(stack, worldIn, tooltip, flagIn); } @@ -96,7 +99,7 @@ public class SchematicItem extends Item { String filepath = ""; if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER) - filepath = CreateConfig.parameters.schematicPath + "/" + owner + "/" + schematic; + filepath = CreateConfig.parameters.schematicPath.get() + "/" + owner + "/" + schematic; else filepath = "schematics/" + schematic; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 34dcf7b82..568994456 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -4,7 +4,7 @@ loaderVersion="[28,)" [[mods]] modId="create" -version="0.0.5" +version="0.1.0" displayName="Create" #updateJSONURL="" authors="simibubi" @@ -14,7 +14,7 @@ A handful of additions to aid the creative survivalist.''' [[dependencies.create]] modId="forge" mandatory=true - versionRange="[28.0.45,)" + versionRange="[28.1.0,)" ordering="NONE" side="BOTH" diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index f8a41473f..cda9fe075 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -147,11 +147,11 @@ "create.recipe.crushing": "Crushing", "create.recipe.splashing": "Bulk Washing", - "create.recipe.splashing.fan": "Fan behind §9Flowing Water", + "create.recipe.splashing.fan": "Fan behind Flowing Water", "create.recipe.smokingViaFan": "Bulk Smoking", - "create.recipe.smokingViaFan.fan": "Fan behind §6Fire", + "create.recipe.smokingViaFan.fan": "Fan behind Fire", "create.recipe.blastingViaFan": "Bulk Smelting", - "create.recipe.blastingViaFan.fan": "Fan behind §6Lava", + "create.recipe.blastingViaFan.fan": "Fan behind Lava", "create.recipe.pressing": "Mechanical Press", "create.recipe.blockzapperUpgrade": "Handheld Blockzapper", "create.recipe.processing.chance": "%1$s%% Chance", @@ -241,6 +241,7 @@ "create.schematicAndQuill.fallbackName": "My Schematic", "create.schematicAndQuill.saved": "Saved as %1$s", + "create.schematic.invalid": "[!] Invalid Item - Use the Schematic Table instead", "create.schematic.position": "Position", "create.schematic.rotation": "Rotation", "create.schematic.rotation.none": "None", diff --git a/src/main/resources/assets/create/models/block/mechanical_bearing_base.json b/src/main/resources/assets/create/models/block/mechanical_bearing_base.json index ab4d568e6..bbd3f02a6 100644 --- a/src/main/resources/assets/create/models/block/mechanical_bearing_base.json +++ b/src/main/resources/assets/create/models/block/mechanical_bearing_base.json @@ -3,9 +3,23 @@ "textures": { "particle": "create:block/bearing_side", "gearbox": "create:block/gearbox", - "bearing_side": "create:block/bearing_side" + "bearing_side": "create:block/bearing_side", + "brass_casing": "create:block/brass_casing" }, "elements": [ + { + "name": "Indicator", + "from": [ 6, 10, 16 ], + "to": [ 10, 12, 17 ], + "faces": { + "north": { "texture": "#brass_casing", "uv": [ 3, 0, 7, 2 ] }, + "east": { "texture": "#brass_casing", "uv": [ 7, 14, 8, 16 ] }, + "south": { "texture": "#brass_casing", "uv": [ 6, 14, 10, 16 ] }, + "west": { "texture": "#brass_casing", "uv": [ 8, 14, 9, 16 ] }, + "up": { "texture": "#brass_casing", "uv": [ 6, 1, 10, 2 ] }, + "down": { "texture": "#brass_casing", "uv": [ 6, 0, 10, 1 ] } + } + }, { "name": "Side", "from": [ 0, 0, 0 ], diff --git a/src/main/resources/assets/create/models/block/mechanical_bearing_top.json b/src/main/resources/assets/create/models/block/mechanical_bearing_top.json index 34ec58c56..ba932507d 100644 --- a/src/main/resources/assets/create/models/block/mechanical_bearing_top.json +++ b/src/main/resources/assets/create/models/block/mechanical_bearing_top.json @@ -3,9 +3,23 @@ "textures": { "particle": "create:block/bearing_side", "bearing_top": "create:block/bearing_top", - "bearing_side": "create:block/bearing_side" + "bearing_side": "create:block/bearing_side", + "brass_casing": "create:block/brass_casing" }, "elements": [ + { + "name": "Cube", + "from": [ 6, 12, 16 ], + "to": [ 10, 14, 17 ], + "faces": { + "north": { "texture": "#brass_casing", "uv": [ 3, 0, 7, 2 ] }, + "east": { "texture": "#brass_casing", "uv": [ 7, 0, 8, 2 ] }, + "south": { "texture": "#brass_casing", "uv": [ 6, 0, 10, 2 ] }, + "west": { "texture": "#brass_casing", "uv": [ 8, 0, 9, 2 ] }, + "up": { "texture": "#brass_casing", "uv": [ 6, 0, 10, 1 ] }, + "down": { "texture": "#brass_casing", "uv": [ 6, 1, 10, 2 ] } + } + }, { "name": "Top", "from": [ 0, 12, 0 ],