mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-23 21:46:40 +01:00
Bug Busting 0.1 Part II
- Removed WIP Items from Creative Tab - Added option to disable tooltips - Moved common config values to synced serverconfig - Numbers on Scrollable Blocks are centered - Motors can be configured to rotate with negative speed - Fixed Processing Recipes Serializer (severe) - Fixed Moving constructs not rendering at a reasonable distance - Mechanical Bearing always solidifies when empty - Fixed some movement incosistencies with translation constructs - Fixed Crushing Wheel Controller not stopping when Wheels do - Fixed Crushing Wheels ejecting entities on world reload - Fixed Movement inconsistencies with Mechanical Belts - Added rotation propagation through large cogwheels connected at a 90 degree angle - Fixed Client code being called server side - Fixed Abstract Method errors regarding Extractors and FrequencyHolders - Added a unit character to Flexpeater display - Fixed additional washing outputs from flying all over the place - Schematicannon now ignores Structure Void blocks - Fixed Schematic hologram not displaying - Added little indicators to the Mechanical Bearing to visualize curent angle - Bumped version
This commit is contained in:
parent
5c8206030c
commit
687e96135a
34 changed files with 311 additions and 130 deletions
|
@ -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")
|
||||
|
|
|
@ -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)),
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<Axis> 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();
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
|
|||
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<T extends ProcessingRecipe<?>>
|
|||
String s = buffer.readString(32767);
|
||||
|
||||
List<Ingredient> 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<StochasticOutput> 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<T extends ProcessingRecipe<?>>
|
|||
|
||||
buffer.writeInt(recipe.getRollableResults().size());
|
||||
recipe.getRollableResults().forEach(i -> i.write(buffer));
|
||||
|
||||
|
||||
buffer.writeInt(recipe.processingDuration);
|
||||
}
|
||||
|
||||
public interface IRecipeFactory<T extends ProcessingRecipe<?>> {
|
||||
T create(ResourceLocation id, String group, List<Ingredient> ingredients, List<StochasticOutput> results, int duration);
|
||||
T create(ResourceLocation id, String group, List<Ingredient> ingredients, List<StochasticOutput> results,
|
||||
int duration);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Entity> 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<Entity> 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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<BlockInfo> 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<BlockInfo> 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();
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class FrequencyHandler {
|
|||
}
|
||||
|
||||
public List<IHaveWireless> getNetworkOf(IHaveWireless actor) {
|
||||
Map<Pair<Frequency, Frequency>, List<IHaveWireless>> networksInWorld = networksIn(actor.getWorld());
|
||||
Map<Pair<Frequency, Frequency>, List<IHaveWireless>> networksInWorld = networksIn(actor.getWirelessWorld());
|
||||
Pair<Frequency, Frequency> key = getNetworkKey(actor);
|
||||
if (!networksInWorld.containsKey(key))
|
||||
networksInWorld.put(key, new ArrayList<>());
|
||||
|
@ -79,7 +79,7 @@ public class FrequencyHandler {
|
|||
List<IHaveWireless> 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<Pair<Frequency, Frequency>, List<IHaveWireless>> networksIn(IWorld world) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class BeltFunnelTileEntity extends SyncedTileEntity implements ITickableT
|
|||
initialize = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setInventory(LazyOptional<IItemHandler> inventory) {
|
||||
this.inventory = inventory;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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 ],
|
||||
|
|
|
@ -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 ],
|
||||
|
|
Loading…
Reference in a new issue