mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-16 23:11:40 +01:00
Better Goggles and Rpm
- Shifted speed unit to resemble rpm (revolutes per minute) - Moved stress defaults to new class - Adjusted processing duration for machines to respect the visual speed change - Drastically lowered the speed range - Stressed networks now indicate better - Goggles now show detailed information when looking at components, especially the gauges - Sand Paper can now be used on items held in the offhand - Item entities on a moving crushing wheel can no longer be picked up - Crushing wheels no longer drop their contents when the wheels stop moving
This commit is contained in:
parent
6be5ed3d1b
commit
ce4c5d5c50
47 changed files with 507 additions and 173 deletions
|
@ -216,11 +216,11 @@ public class CreateConfig {
|
|||
|
||||
name = "fanRotationArgmax";
|
||||
fanRotationArgmax = builder.comment("", "Rotation speed at which the maximum stats of fans are reached.")
|
||||
.translation(basePath + name).defineInRange(name, 1024, 64, Integer.MAX_VALUE);
|
||||
.translation(basePath + name).defineInRange(name, 256, 64, Integer.MAX_VALUE);
|
||||
|
||||
name = "generatingFanSpeed";
|
||||
generatingFanSpeed = builder.comment("", "Rotation speed generated by a vertical fan above fire.")
|
||||
.translation(basePath + name).defineInRange(name, 32, 0, Integer.MAX_VALUE);
|
||||
.translation(basePath + name).defineInRange(name, 16, 0, Integer.MAX_VALUE);
|
||||
|
||||
name = "inWorldProcessingTime";
|
||||
inWorldProcessingTime = builder
|
||||
|
@ -259,11 +259,11 @@ public class CreateConfig {
|
|||
|
||||
name = "maxMotorSpeed";
|
||||
maxMotorSpeed = builder.comment("", "Maximum allowed speed of a configurable motor.")
|
||||
.translation(basePath + name).defineInRange(name, 4096, 64, Integer.MAX_VALUE);
|
||||
.translation(basePath + name).defineInRange(name, 256, 64, Integer.MAX_VALUE);
|
||||
|
||||
name = "maxRotationSpeed";
|
||||
maxRotationSpeed = builder.comment("", "Maximum allowed rotation speed for any Kinetic Tile.")
|
||||
.translation(basePath + name).defineInRange(name, 16384, 64, Integer.MAX_VALUE);
|
||||
.translation(basePath + name).defineInRange(name, 256, 64, Integer.MAX_VALUE);
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
|
@ -369,11 +369,11 @@ public class CreateConfig {
|
|||
|
||||
name = "mediumSpeed";
|
||||
mediumSpeed = builder.comment("", "[in Degrees/Tick]", "Minimum speed of rotation to be considered 'medium'")
|
||||
.translation(basePath + name).defineInRange(name, 32D, 0D, 4096D);
|
||||
.translation(basePath + name).defineInRange(name, 30D, 0D, 4096D);
|
||||
|
||||
name = "fastSpeed";
|
||||
fastSpeed = builder.comment("", "[in Degrees/Tick]", "Minimum speed of rotation to be considered 'fast'")
|
||||
.translation(basePath + name).defineInRange(name, 512D, 0D, 65535D);
|
||||
.translation(basePath + name).defineInRange(name, 100D, 0D, 65535D);
|
||||
|
||||
name = "mediumStressImpact";
|
||||
mediumStressImpact = builder.comment("", "Minimum stress impact to be considered 'medium'")
|
||||
|
@ -419,11 +419,11 @@ public class CreateConfig {
|
|||
String basePath = "create.config.stress.";
|
||||
String name = block.name();
|
||||
stressEntries.put(block.get().getRegistryName(), builder.comment("").translation(basePath + name)
|
||||
.defineInRange(name, getDefaultStressImpact(block), 0, 2048));
|
||||
.defineInRange(name, StressConfigDefaults.getDefaultStressImpact(block), 0, 2048));
|
||||
}
|
||||
|
||||
private void initStressCapacityEntry(AllBlocks block, final ForgeConfigSpec.Builder builder) {
|
||||
double defaultStressCapacity = getDefaultStressCapacity(block);
|
||||
double defaultStressCapacity = StressConfigDefaults.getDefaultStressCapacity(block);
|
||||
if (defaultStressCapacity == -1)
|
||||
return;
|
||||
String basePath = "create.config.stressCapacity.";
|
||||
|
@ -432,66 +432,6 @@ public class CreateConfig {
|
|||
builder.comment("").translation(basePath + name).defineInRange(name, defaultStressCapacity, 0, 4096D));
|
||||
}
|
||||
|
||||
public static double getDefaultStressCapacity(AllBlocks block) {
|
||||
|
||||
switch (block) {
|
||||
case MOTOR:
|
||||
return 1024;
|
||||
case ENCASED_FAN:
|
||||
case HAND_CRANK:
|
||||
return 64;
|
||||
case WATER_WHEEL:
|
||||
return 32;
|
||||
case MECHANICAL_BEARING:
|
||||
return 128;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static double getDefaultStressImpact(AllBlocks block) {
|
||||
|
||||
switch (block) {
|
||||
case CRUSHING_WHEEL:
|
||||
case MECHANICAL_PRESS:
|
||||
case MOTOR:
|
||||
return 32;
|
||||
|
||||
case DRILL:
|
||||
case SAW:
|
||||
case MECHANICAL_PISTON:
|
||||
case STICKY_MECHANICAL_PISTON:
|
||||
return 16;
|
||||
|
||||
case ENCASED_FAN:
|
||||
case MECHANICAL_MIXER:
|
||||
case MECHANICAL_BEARING:
|
||||
case MECHANICAL_CRAFTER:
|
||||
return 8;
|
||||
|
||||
case WATER_WHEEL:
|
||||
case TURNTABLE:
|
||||
case GEARBOX:
|
||||
case GEARSHIFT:
|
||||
case LARGE_COGWHEEL:
|
||||
return 4;
|
||||
|
||||
case CLUTCH:
|
||||
return 2;
|
||||
|
||||
case BELT:
|
||||
case COGWHEEL:
|
||||
case ENCASED_BELT:
|
||||
case ENCASED_SHAFT:
|
||||
case SHAFT:
|
||||
case SPEED_GAUGE:
|
||||
case STRESS_GAUGE:
|
||||
case HAND_CRANK:
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidPath(Object path) {
|
||||
if (!(path instanceof String))
|
||||
return false;
|
||||
|
|
53
src/main/java/com/simibubi/create/StressConfigDefaults.java
Normal file
53
src/main/java/com/simibubi/create/StressConfigDefaults.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
package com.simibubi.create;
|
||||
|
||||
public class StressConfigDefaults {
|
||||
|
||||
public static double getDefaultStressCapacity(AllBlocks block) {
|
||||
|
||||
switch (block) {
|
||||
case MOTOR:
|
||||
return 1024;
|
||||
case MECHANICAL_BEARING:
|
||||
return 128;
|
||||
case ENCASED_FAN:
|
||||
case HAND_CRANK:
|
||||
return 64;
|
||||
case WATER_WHEEL:
|
||||
return 32;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static double getDefaultStressImpact(AllBlocks block) {
|
||||
|
||||
switch (block) {
|
||||
case CRUSHING_WHEEL:
|
||||
case MECHANICAL_PRESS:
|
||||
return 32;
|
||||
|
||||
case DRILL:
|
||||
case SAW:
|
||||
case DEPLOYER:
|
||||
return 16;
|
||||
|
||||
case ENCASED_FAN:
|
||||
case MECHANICAL_MIXER:
|
||||
case MECHANICAL_BEARING:
|
||||
case MECHANICAL_CRAFTER:
|
||||
return 8;
|
||||
|
||||
case TURNTABLE:
|
||||
case MECHANICAL_PISTON:
|
||||
case STICKY_MECHANICAL_PISTON:
|
||||
return 4;
|
||||
|
||||
case BELT:
|
||||
return 2;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@ package com.simibubi.create.foundation.command;
|
|||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.Commands;
|
||||
|
||||
|
|
|
@ -21,13 +21,16 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
@ -80,17 +83,26 @@ public class ItemDescription {
|
|||
SpeedLevel minimumRequiredSpeedLevel = block.getMinimumRequiredSpeedLevel();
|
||||
boolean hasSpeedRequirement = minimumRequiredSpeedLevel != SpeedLevel.NONE;
|
||||
ResourceLocation id = ((Block) block).getRegistryName();
|
||||
boolean hasStressImpact = parameters.stressEntries.containsKey(id);
|
||||
boolean hasStressImpact = parameters.stressEntries.containsKey(id)
|
||||
&& parameters.stressEntries.get(id).get() > 0;
|
||||
boolean hasStressCapacity = parameters.stressCapacityEntries.containsKey(id);
|
||||
boolean hasGlasses = AllItems.GOGGLES
|
||||
.typeOf(Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.HEAD));
|
||||
|
||||
String rpmUnit = Lang.translate("generic.unit.rpm");
|
||||
if (hasSpeedRequirement) {
|
||||
List<String> speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high");
|
||||
int index = minimumRequiredSpeedLevel.ordinal();
|
||||
String level = minimumRequiredSpeedLevel.getTextColor() + makeProgressBar(3, index)
|
||||
+ speedLevels.get(index);
|
||||
|
||||
if (hasGlasses)
|
||||
level += " (" + minimumRequiredSpeedLevel.getSpeedValue() + rpmUnit + "+)";
|
||||
|
||||
add(linesOnShift, GRAY + Lang.translate("tooltip.speedRequirement"));
|
||||
add(linesOnShift, level);
|
||||
}
|
||||
String stressUnit = Lang.translate("generic.unit.stress");
|
||||
if (hasStressImpact && !block.hideStressImpact()) {
|
||||
List<String> stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high");
|
||||
double impact = parameters.stressEntries.get(id).get();
|
||||
|
@ -98,6 +110,10 @@ public class ItemDescription {
|
|||
: (impact >= parameters.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW);
|
||||
int index = impactId.ordinal();
|
||||
String level = impactId.getColor() + makeProgressBar(3, index) + stressLevels.get(index);
|
||||
|
||||
if (hasGlasses)
|
||||
level += " (" + parameters.stressEntries.get(id).get() + stressUnit + ")";
|
||||
|
||||
add(linesOnShift, GRAY + Lang.translate("tooltip.stressImpact"));
|
||||
add(linesOnShift, level);
|
||||
|
||||
|
@ -110,6 +126,9 @@ public class ItemDescription {
|
|||
: (capacity >= parameters.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH);
|
||||
int index = StressImpact.values().length - 1 - impactId.ordinal();
|
||||
String level = impactId.getColor() + makeProgressBar(3, index) + stressCapacityLevels.get(index);
|
||||
|
||||
if (hasGlasses)
|
||||
level += " (" + capacity + stressUnit + ")";
|
||||
if (block.showCapacityWithAnnotation())
|
||||
level += " " + DARK_GRAY + TextFormatting.ITALIC
|
||||
+ Lang.translate("tooltip.capacityProvided.asGenerator");
|
||||
|
@ -123,7 +142,7 @@ public class ItemDescription {
|
|||
return this;
|
||||
}
|
||||
|
||||
protected String makeProgressBar(int length, int filledLength) {
|
||||
public static String makeProgressBar(int length, int filledLength) {
|
||||
String bar = " ";
|
||||
int emptySpaces = length - 1 - filledLength;
|
||||
for (int i = 0; i <= filledLength; i++)
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.mojang.bridge.game.Language;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.item.ItemDescription.Palette;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.modules.IModule;
|
||||
|
@ -15,6 +16,7 @@ import com.simibubi.create.modules.contraptions.base.IRotate;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
@ -24,6 +26,7 @@ public class TooltipHelper {
|
|||
public static final int maxCharsPerLine = 35;
|
||||
public static final Map<String, ItemDescription> cachedTooltips = new HashMap<>();
|
||||
public static Language cachedLanguage;
|
||||
private static boolean gogglesMode;
|
||||
|
||||
public static String holdShift(Palette color, boolean highlighted) {
|
||||
TextFormatting colorFormat = highlighted ? color.hColor : color.color;
|
||||
|
@ -81,7 +84,13 @@ public class TooltipHelper {
|
|||
|
||||
public static boolean hasTooltip(ItemStack stack) {
|
||||
checkLocale();
|
||||
// cachedTooltips.clear();
|
||||
|
||||
boolean hasGlasses = AllItems.GOGGLES.typeOf(Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.HEAD));
|
||||
if (hasGlasses != gogglesMode) {
|
||||
gogglesMode = hasGlasses;
|
||||
cachedTooltips.clear();
|
||||
}
|
||||
|
||||
String key = getTooltipTranslationKey(stack);
|
||||
if (cachedTooltips.containsKey(key))
|
||||
return cachedTooltips.get(key) != ItemDescription.MISSING;
|
||||
|
|
|
@ -11,7 +11,7 @@ public class AnimationTickHolder {
|
|||
}
|
||||
|
||||
public static float getRenderTick() {
|
||||
return (ticks + Minecraft.getInstance().getRenderPartialTicks()) / 20;
|
||||
return ticks + Minecraft.getInstance().getRenderPartialTicks();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.CreateClientConfig;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
|
|
|
@ -21,7 +21,7 @@ public class WrenchItemRenderer extends ItemStackTileEntityRenderer {
|
|||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
itemRenderer.renderItem(stack, mainModel.getBakedModel());
|
||||
|
||||
float angle = worldTime * -10 % 360;
|
||||
float angle = worldTime * -.5f % 360;
|
||||
|
||||
float xOffset = -1/32f;
|
||||
float zOffset = 0;
|
||||
|
|
|
@ -38,6 +38,19 @@ public interface IRotate extends IWrenchable {
|
|||
}
|
||||
return NONE;
|
||||
}
|
||||
|
||||
public float getSpeedValue() {
|
||||
switch (this) {
|
||||
case FAST:
|
||||
return CreateConfig.parameters.fastSpeed.get().floatValue();
|
||||
case MEDIUM:
|
||||
return CreateConfig.parameters.mediumSpeed.get().floatValue();
|
||||
case NONE:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum StressImpact {
|
||||
|
|
|
@ -23,7 +23,8 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.particles.RedstoneParticleData;
|
||||
import net.minecraft.particles.IParticleData;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
|
@ -48,12 +49,14 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
|||
public float maxStress;
|
||||
public float currentStress;
|
||||
protected boolean overStressed;
|
||||
|
||||
public UUID networkID;
|
||||
public UUID newNetworkID;
|
||||
public boolean updateNetwork;
|
||||
protected boolean initNetwork;
|
||||
|
||||
// Client
|
||||
float overStressedEffect;
|
||||
|
||||
public KineticTileEntity(TileEntityType<?> typeIn) {
|
||||
super(typeIn);
|
||||
speed = 0;
|
||||
|
@ -161,6 +164,21 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
|||
super.read(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readClientUpdate(CompoundNBT tag) {
|
||||
boolean overStressedBefore = overStressed;
|
||||
super.readClientUpdate(tag);
|
||||
if (overStressedBefore != overStressed && speed != 0) {
|
||||
if (overStressed) {
|
||||
overStressedEffect = 1;
|
||||
spawnEffect(ParticleTypes.SMOKE, 0.2f, 5);
|
||||
} else {
|
||||
overStressedEffect = -1;
|
||||
spawnEffect(ParticleTypes.CLOUD, .075f, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSource() {
|
||||
return getGeneratedSpeed() != 0;
|
||||
}
|
||||
|
@ -177,15 +195,6 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
|||
|
||||
public void setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
if (hasWorld() && speed != 0 && world.isRemote) {
|
||||
Random r = getWorld().rand;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
float x = getPos().getX() + (r.nextFloat() - .5f) / 2f + .5f;
|
||||
float y = getPos().getY() + (r.nextFloat() - .5f) / 2f + .5f;
|
||||
float z = getPos().getZ() + (r.nextFloat() - .5f) / 2f + .5f;
|
||||
this.getWorld().addParticle(new RedstoneParticleData(1, 1, 1, 1), x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasSource() {
|
||||
|
@ -274,8 +283,15 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if (world.isRemote)
|
||||
if (world.isRemote) {
|
||||
if (overStressedEffect != 0) {
|
||||
overStressedEffect -= overStressedEffect * .1f;
|
||||
if (Math.abs(overStressedEffect) < 1 / 128f)
|
||||
overStressedEffect = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (speedChangeCounter > 0)
|
||||
speedChangeCounter--;
|
||||
|
||||
|
@ -344,6 +360,19 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
|||
particleSpawnCountdown = 2;
|
||||
}
|
||||
|
||||
protected void spawnEffect(IParticleData particle, float maxMotion, int amount) {
|
||||
if (!hasWorld())
|
||||
return;
|
||||
if (!world.isRemote)
|
||||
return;
|
||||
Random r = getWorld().rand;
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Vec3d motion = VecHelper.offsetRandomly(Vec3d.ZERO, r, maxMotion);
|
||||
Vec3d position = VecHelper.getCenterOf(pos);
|
||||
this.getWorld().addParticle(particle, position.x, position.y, position.z, motion.x, motion.y, motion.z);
|
||||
}
|
||||
}
|
||||
|
||||
protected void spawnRotationIndicators() {
|
||||
if (getSpeed() == 0)
|
||||
return;
|
||||
|
|
|
@ -38,7 +38,7 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast<KineticTil
|
|||
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||
float angle = (float) (((time * te.getSpeed() + offset) % 360) / 180 * (float) Math.PI);
|
||||
float angle = ((time * te.getSpeed() * 3f/10 + offset) % 360) / 180 * (float) Math.PI;
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
@ -55,12 +55,21 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast<KineticTil
|
|||
buffer.light(packedLightmapCoords);
|
||||
buffer.rotateCentered(axis, angle);
|
||||
|
||||
int white = 0xFFFFFF;
|
||||
if (KineticDebugger.isActive()) {
|
||||
rainbowMode = true;
|
||||
if (te.hasNetwork())
|
||||
buffer.color(ColorHelper.colorFromUUID(te.getNetworkID()));
|
||||
else
|
||||
buffer.color(0xFFFFFF);
|
||||
buffer.color(white);
|
||||
} else {
|
||||
if (te.overStressedEffect != 0)
|
||||
if (te.overStressedEffect > 0)
|
||||
buffer.color(ColorHelper.mixColors(white, 0xFF0000, te.overStressedEffect));
|
||||
else
|
||||
buffer.color(ColorHelper.mixColors(white, 0x00FFBB, -te.overStressedEffect));
|
||||
else
|
||||
buffer.color(white);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
|
|
|
@ -144,7 +144,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
protected float getBreakSpeed() {
|
||||
return Math.abs(speed / 100f);
|
||||
return Math.abs(getSpeed() / 100f);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class DrillTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
? context.getAnimationSpeed()
|
||||
: 0);
|
||||
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
float time = AnimationTickHolder.getRenderTick() / 20;
|
||||
float angle = (float) (((time * speed) % 360) / 180 * (float) Math.PI);
|
||||
|
||||
return buffer.rotateCentered(axis, angle);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class HarvesterTileEntityRenderer extends TileEntityRenderer<HarvesterTil
|
|||
float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, state.get(HORIZONTAL_FACING).getOpposite())
|
||||
? context.getAnimationSpeed() * state.get(HORIZONTAL_FACING).getAxisDirection().getOffset()
|
||||
: 0);
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
float time = AnimationTickHolder.getRenderTick() / 20;
|
||||
float angle = (float) (((time * speed) % 360) / 180 * (float) Math.PI);
|
||||
|
||||
return renderHead(context.world, BlockPos.ZERO, state, angle);
|
||||
|
|
|
@ -31,6 +31,11 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
|||
return isWindmill ? super.getAddedStressCapacity() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStressApplied() {
|
||||
return isWindmill ? 0 : super.getStressApplied();
|
||||
}
|
||||
|
||||
public void neighbourChanged() {
|
||||
boolean shouldWindmill = world.isBlockPowered(pos);
|
||||
if (shouldWindmill == isWindmill)
|
||||
|
@ -64,8 +69,8 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
|||
return 0;
|
||||
if (movedContraption == null)
|
||||
return 0;
|
||||
int sails = ((BearingContraption) movedContraption.getContraption()).getSailBlocks();
|
||||
return MathHelper.clamp(sails, 0, 128);
|
||||
int sails = ((BearingContraption) movedContraption.getContraption()).getSailBlocks() / 8;
|
||||
return MathHelper.clamp(sails, 1, 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,7 +100,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
|||
}
|
||||
|
||||
public float getAngularSpeed() {
|
||||
return getSpeed() / 2048;
|
||||
return getSpeed() * 3 / 10f;
|
||||
}
|
||||
|
||||
public void assembleConstruct() {
|
||||
|
@ -143,7 +148,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
|||
if (!world.isRemote && assembleNextTick) {
|
||||
assembleNextTick = false;
|
||||
if (running) {
|
||||
boolean canDisassemble = Math.abs(angle) < Math.PI / 4f || Math.abs(angle) > 7 * Math.PI / 4f;
|
||||
boolean canDisassemble = Math.abs(angle) < 45 || Math.abs(angle) > 7 * 45;
|
||||
if (speed == 0 && (canDisassemble || movedContraption == null
|
||||
|| movedContraption.getContraption().blocks.isEmpty())) {
|
||||
disassembleConstruct();
|
||||
|
@ -162,14 +167,14 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
|||
|
||||
float angularSpeed = getAngularSpeed();
|
||||
float newAngle = angle + angularSpeed;
|
||||
angle = (float) (newAngle % (2 * Math.PI));
|
||||
angle = (float) (newAngle % 360);
|
||||
applyRotation();
|
||||
}
|
||||
|
||||
private void applyRotation() {
|
||||
if (movedContraption != null) {
|
||||
Direction direction = getBlockState().get(BlockStateProperties.FACING);
|
||||
Vec3d vec = new Vec3d(1, 1, 1).scale(angle * 180 / Math.PI).mul(new Vec3d(direction.getDirectionVec()));
|
||||
Vec3d vec = new Vec3d(1, 1, 1).scale(angle).mul(new Vec3d(direction.getDirectionVec()));
|
||||
movedContraption.rotateTo(vec.x, vec.y, -vec.z);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class MechanicalBearingTileEntityRenderer extends KineticTileEntityRender
|
|||
|
||||
SuperByteBuffer superBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, capState);
|
||||
float interpolatedAngle = bearingTe.getInterpolatedAngle(partialTicks);
|
||||
kineticRotationTransform(superBuffer, bearingTe, facing.getAxis(), interpolatedAngle, getWorld());
|
||||
kineticRotationTransform(superBuffer, bearingTe, facing.getAxis(), (float) (interpolatedAngle / 180 * Math.PI), getWorld());
|
||||
superBuffer.translate(x, y, z).renderInto(buffer);
|
||||
}
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ public class MechanicalPistonTileEntity extends KineticTileEntity implements ICo
|
|||
Direction pistonDirection = getBlockState().get(BlockStateProperties.FACING);
|
||||
int movementModifier = pistonDirection.getAxisDirection().getOffset()
|
||||
* (pistonDirection.getAxis() == Axis.Z ? -1 : 1);
|
||||
return getSpeed() * -movementModifier / 1024f;
|
||||
return getSpeed() * -movementModifier / 512f;
|
||||
}
|
||||
|
||||
public Vec3d getConstructOffset(float partialTicks) {
|
||||
|
|
|
@ -178,7 +178,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
public int getCountDownSpeed() {
|
||||
if (getSpeed() == 0)
|
||||
return 0;
|
||||
return MathHelper.clamp((int) Math.abs(getSpeed() / 2), 1, 250);
|
||||
return MathHelper.clamp((int) Math.abs(getSpeed()), 4, 250);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,7 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity {
|
|||
|
||||
@Override
|
||||
public float getGeneratedSpeed() {
|
||||
return inUse == 0 ? 0 : backwards ? -128 : 128;
|
||||
return inUse == 0 ? 0 : backwards ? -32 : 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +36,7 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity {
|
|||
super.tick();
|
||||
|
||||
float actualSpeed = getSpeed();
|
||||
chasingVelocity += (actualSpeed - chasingVelocity) * .25f;
|
||||
chasingVelocity += ((actualSpeed * 10 / 3f) - chasingVelocity) * .25f;
|
||||
independentAngle += chasingVelocity;
|
||||
|
||||
if (inUse > 0) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
|
@ -81,6 +82,10 @@ public class CrushingWheelControllerBlock extends Block implements IHaveNoBlockI
|
|||
if (!(tileEntity instanceof CrushingWheelControllerTileEntity))
|
||||
return;
|
||||
CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) tileEntity;
|
||||
if (te.crushingspeed == 0)
|
||||
return;
|
||||
if (entityIn instanceof ItemEntity)
|
||||
((ItemEntity) entityIn).setPickupDelay(10);
|
||||
if (te.isOccupied())
|
||||
return;
|
||||
if ((entityIn instanceof PlayerEntity) && ((PlayerEntity) entityIn).isCreative())
|
||||
|
@ -167,16 +172,15 @@ public class CrushingWheelControllerBlock extends Block implements IHaveNoBlockI
|
|||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
if (worldIn.getTileEntity(pos) == null)
|
||||
return;
|
||||
|
||||
CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) worldIn.getTileEntity(pos);
|
||||
for (int slot = 0; slot < te.inventory.getSizeInventory(); slot++) {
|
||||
InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(),
|
||||
te.inventory.getStackInSlot(slot));
|
||||
}
|
||||
|
||||
if (state.hasTileEntity() && state.getBlock() != newState.getBlock()) {
|
||||
if (worldIn.getTileEntity(pos) == null)
|
||||
return;
|
||||
CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) worldIn.getTileEntity(pos);
|
||||
for (int slot = 0; slot < te.inventory.getSizeInventory(); slot++) {
|
||||
InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(),
|
||||
te.inventory.getStackInSlot(slot));
|
||||
}
|
||||
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import net.minecraft.particles.ItemParticleData;
|
|||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class CrushingWheelControllerTileEntity extends SyncedTileEntity implements ITickableTileEntity {
|
||||
|
@ -59,12 +60,14 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen
|
|||
if (crushingspeed == 0)
|
||||
return;
|
||||
|
||||
float speed = crushingspeed / 2.5f;
|
||||
float speed = crushingspeed * 4;
|
||||
Vec3d outPos = VecHelper.getCenterOf(pos);
|
||||
|
||||
if (!hasEntity()) {
|
||||
|
||||
float processingSpeed = speed / (!inventory.appliedRecipe ? inventory.getStackInSlot(0).getCount() : 1);
|
||||
float processingSpeed = MathHelper.clamp(
|
||||
(speed) / (!inventory.appliedRecipe ? MathHelper.log2(inventory.getStackInSlot(0).getCount()) : 1),
|
||||
.25f, 20);
|
||||
inventory.remainingTime -= processingSpeed;
|
||||
spawnParticles(inventory.getStackInSlot(0));
|
||||
|
||||
|
@ -122,6 +125,7 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen
|
|||
}
|
||||
|
||||
ItemEntity itemEntity = (ItemEntity) processingEntity;
|
||||
itemEntity.setPickupDelay(20);
|
||||
if (processingEntity.posY < pos.getY() + .25f) {
|
||||
insertItem(itemEntity);
|
||||
itemEntity.remove();
|
||||
|
|
|
@ -141,7 +141,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
protected int getTimerSpeed() {
|
||||
return (int) (getSpeed() == 0 ? 0 : MathHelper.clamp(Math.abs(getSpeed()) / 2, 8, 512));
|
||||
return (int) (getSpeed() == 0 ? 0 : MathHelper.clamp(Math.abs(getSpeed() * 2), 8, 512));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,10 +22,12 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -61,15 +63,16 @@ public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileE
|
|||
GlStateManager.rotatef(zRot, 1, 0, 0);
|
||||
GlStateManager.translated(0, 0, -11 / 16f);
|
||||
|
||||
if (punching) {
|
||||
GlStateManager.translatef(0, 1/8f, -1/16f);
|
||||
// GlStateManager.rotatef(punching ? -45 : 0, 1, 0, 0);
|
||||
}
|
||||
if (punching)
|
||||
GlStateManager.translatef(0, 1 / 8f, -1 / 16f);
|
||||
|
||||
float scale = punching ? .75f : .5f;
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
boolean isBlockItem = (te.heldItem.getItem() instanceof BlockItem)
|
||||
&& itemRenderer.getModelWithOverrides(te.heldItem).isGui3d();
|
||||
float scale = punching ? .75f : isBlockItem ? .75f - 1 / 64f : .5f;
|
||||
GlStateManager.scaled(scale, scale, scale);
|
||||
TransformType transform = punching ? TransformType.THIRD_PERSON_RIGHT_HAND : TransformType.FIXED;
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(te.heldItem, transform);
|
||||
itemRenderer.renderItem(te.heldItem, transform);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
@ -103,7 +106,7 @@ public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileE
|
|||
|
||||
float handLength = te.getHandPose() == AllBlocks.DEPLOYER_HAND_POINTING ? 0
|
||||
: te.getHandPose() == AllBlocks.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
|
||||
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (te.reach + handLength), 21/16f);
|
||||
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (te.reach + handLength), 21 / 16f);
|
||||
Vec3d offset = new Vec3d(blockState.get(FACING).getDirectionVec()).scale(distance);
|
||||
return offset;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,11 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity {
|
|||
return isGenerator ? super.getAddedStressCapacity() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStressApplied() {
|
||||
return isGenerator ? 0 : super.getStressApplied();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneratedSpeed() {
|
||||
return isGenerator ? CreateConfig.parameters.generatingFanSpeed.get() : 0;
|
||||
|
|
|
@ -21,12 +21,12 @@ public class EncasedFanTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
float speed = te.getSpeed() * 20;
|
||||
float speed = te.getSpeed() * 5;
|
||||
if (speed > 0)
|
||||
speed = MathHelper.clamp(speed, 80, 64 * 20);
|
||||
if (speed < 0)
|
||||
speed = MathHelper.clamp(speed, -64 * 20, -80);
|
||||
float angle = (time * speed) % 360;
|
||||
float angle = (time * speed * 3/10f) % 360;
|
||||
angle = angle / 180f * (float) Math.PI;
|
||||
|
||||
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE,
|
||||
|
|
|
@ -136,7 +136,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
|
|||
|
||||
if (!world.isRemote && runningTicks == 20) {
|
||||
if (processingTicks < 0) {
|
||||
processingTicks = (MathHelper.log2((int) (8000 / speed))) * 15 + 1;
|
||||
processingTicks = MathHelper.clamp((MathHelper.log2((int) (512 / speed))) * 15 + 1, 1, 512);
|
||||
} else {
|
||||
processingTicks--;
|
||||
if (processingTicks == 0) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class MechanicalMixerTileEntityRenderer extends KineticTileEntityRenderer
|
|||
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
|
||||
float speed = mixer.getRenderedHeadRotationSpeed(partialTicks);
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
float angle = (float) (((time * speed * 2) % 360) / 180 * (float) Math.PI);
|
||||
float angle = (float) (((time * speed * 6 / 10f) % 360) / 180 * (float) Math.PI);
|
||||
|
||||
SuperByteBuffer poleRender = CreateClient.bufferCache.renderGenericBlockModel(poleState);
|
||||
poleRender.translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords).renderInto(buffer);
|
||||
|
|
|
@ -74,13 +74,15 @@ 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.newGeneratedSpeed * (delta > 0 ^ te.newGeneratedSpeed < 0 ? 2 : .5f))));
|
||||
withTileEntityDo(world, pos, te -> {
|
||||
int d = Math.abs(te.newGeneratedSpeed) < 32 ? 4 : 16;
|
||||
te.setSpeedValueLazily((int) (te.newGeneratedSpeed + delta * d));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueName(BlockState state, IWorld world, BlockPos pos) {
|
||||
return Lang.translate("generic.speed");
|
||||
return Lang.translate("generic.speed") + " (" + Lang.translate("generic.unit.rpm") + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,12 +53,7 @@ public class MotorTileEntity extends GeneratingKineticTileEntity {
|
|||
if (newGeneratedSpeed == speed)
|
||||
return;
|
||||
Integer max = CreateConfig.parameters.maxMotorSpeed.get();
|
||||
if (newGeneratedSpeed > 0 && speed == 0)
|
||||
newGeneratedSpeed = -1;
|
||||
else if (newGeneratedSpeed < 0 && speed == 0)
|
||||
newGeneratedSpeed = 1;
|
||||
else
|
||||
newGeneratedSpeed = MathHelper.clamp(speed, -max, max);
|
||||
newGeneratedSpeed = MathHelper.clamp(speed, -max, max);
|
||||
this.lastModified = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TurntableBlock extends KineticBlock {
|
|||
if (e.getMotion().y > 0)
|
||||
return;
|
||||
|
||||
float speed = ((KineticTileEntity) te).getSpeed() / 20;
|
||||
float speed = ((KineticTileEntity) te).getSpeed() * 3/10;
|
||||
World world = e.getEntityWorld();
|
||||
|
||||
if (speed == 0)
|
||||
|
|
|
@ -23,7 +23,7 @@ public class TurntableHandler {
|
|||
return;
|
||||
|
||||
KineticTileEntity te = (KineticTileEntity) mc.world.getTileEntity(pos);
|
||||
float speed = te.getSpeed() / 19;
|
||||
float speed = te.getSpeed() * 3/10;
|
||||
|
||||
if (speed == 0)
|
||||
return;
|
||||
|
|
|
@ -99,7 +99,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock {
|
|||
flow = flowVec.y > 0 ^ !clockwise ? -flowVec.y * clockwiseMultiplier : -flowVec.y;
|
||||
}
|
||||
|
||||
te.setFlow(f, (int) (flow * 20));
|
||||
te.setFlow(f, (int) (flow * 5));
|
||||
}
|
||||
|
||||
private void updateWheelSpeed(IWorld world, BlockPos pos) {
|
||||
|
|
|
@ -9,8 +9,8 @@ import net.minecraftforge.items.ItemStackHandler;
|
|||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||
|
||||
public class ProcessingInventory extends RecipeWrapper implements IItemHandler {
|
||||
public int remainingTime;
|
||||
public int recipeDuration;
|
||||
public float remainingTime;
|
||||
public float recipeDuration;
|
||||
public boolean appliedRecipe;
|
||||
|
||||
public ProcessingInventory() {
|
||||
|
@ -32,8 +32,8 @@ public class ProcessingInventory extends RecipeWrapper implements IItemHandler {
|
|||
stacks.add(stack);
|
||||
}
|
||||
ItemStackHelper.saveAllItems(nbt, stacks);
|
||||
nbt.putInt("ProcessingTime", remainingTime);
|
||||
nbt.putInt("RecipeTime", recipeDuration);
|
||||
nbt.putFloat("ProcessingTime", remainingTime);
|
||||
nbt.putFloat("RecipeTime", recipeDuration);
|
||||
nbt.putBoolean("AppliedRecipe", appliedRecipe);
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,8 @@ public class ProcessingInventory extends RecipeWrapper implements IItemHandler {
|
|||
|
||||
for (int slot = 0; slot < stacks.size(); slot++)
|
||||
inventory.setInventorySlotContents(slot, stacks.get(slot));
|
||||
inventory.remainingTime = nbt.getInt("ProcessingTime");
|
||||
inventory.recipeDuration = nbt.getInt("RecipeTime");
|
||||
inventory.remainingTime = nbt.getFloat("ProcessingTime");
|
||||
inventory.recipeDuration = nbt.getFloat("RecipeTime");
|
||||
inventory.appliedRecipe = nbt.getBoolean("AppliedRecipe");
|
||||
|
||||
return inventory;
|
||||
|
|
|
@ -105,6 +105,13 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
toRemove.forEach(passengers::remove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStressApplied() {
|
||||
if (!isController())
|
||||
return 0;
|
||||
return super.getStressApplied();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
if (!isController())
|
||||
|
@ -205,14 +212,14 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
public float getBeltMovementSpeed() {
|
||||
return getSpeed() / 1600f;
|
||||
return getSpeed() / 480f;
|
||||
}
|
||||
|
||||
public float getDirectionAwareBeltMovementSpeed() {
|
||||
int offset = getBeltFacing().getAxisDirection().getOffset();
|
||||
if (getBeltFacing().getAxis() == Axis.X)
|
||||
offset *= -1;
|
||||
return getSpeed() / 1600f * offset;
|
||||
return getBeltMovementSpeed() * offset;
|
||||
}
|
||||
|
||||
public boolean hasPulley() {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class BeltTileEntityRenderer extends TileEntityRenderer<BeltTileEntity> {
|
|||
* te.getBlockState().get(HORIZONTAL_FACING).getAxisDirection().getOffset();
|
||||
if (renderedState.get(BeltBlock.HORIZONTAL_FACING).getAxis() == Axis.X)
|
||||
speed = -speed;
|
||||
int textureIndex = (int) ((speed * time / 8) % 16);
|
||||
int textureIndex = (int) ((speed * time / 36) % 16);
|
||||
if (textureIndex < 0)
|
||||
textureIndex += 16;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
continue;
|
||||
|
||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||
float angle = (time * te.getSpeed()) % 360;
|
||||
float angle = (time * te.getSpeed() * 3f / 10) % 360;
|
||||
float modifier = 1;
|
||||
|
||||
if (te instanceof SplitShaftTileEntity)
|
||||
|
|
|
@ -0,0 +1,214 @@
|
|||
package com.simibubi.create.modules.contraptions.relays.gauge;
|
||||
|
||||
import static net.minecraft.util.text.TextFormatting.DARK_GRAY;
|
||||
import static net.minecraft.util.text.TextFormatting.GRAY;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
|
||||
import com.simibubi.create.foundation.item.ItemDescription;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.modules.contraptions.base.GeneratingKineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT)
|
||||
public class GaugeInformationRenderer {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
|
||||
if (event.getType() != ElementType.HOTBAR)
|
||||
return;
|
||||
|
||||
RayTraceResult objectMouseOver = Minecraft.getInstance().objectMouseOver;
|
||||
if (!(objectMouseOver instanceof BlockRayTraceResult))
|
||||
return;
|
||||
|
||||
BlockRayTraceResult result = (BlockRayTraceResult) objectMouseOver;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ClientWorld world = mc.world;
|
||||
BlockPos pos = result.getPos();
|
||||
BlockState state = world.getBlockState(pos);
|
||||
ItemStack goggles = mc.player.getItemStackFromSlot(EquipmentSlotType.HEAD);
|
||||
|
||||
if (!AllItems.GOGGLES.typeOf(goggles))
|
||||
return;
|
||||
if (mc.player.isSneaking())
|
||||
return;
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
|
||||
if (state.getBlock() instanceof GaugeBlock)
|
||||
addGaugeTooltip(state, tooltip, te);
|
||||
if (te instanceof GeneratingKineticTileEntity)
|
||||
addGeneratorTooltip(state, tooltip, (GeneratingKineticTileEntity) te);
|
||||
if (te instanceof KineticTileEntity)
|
||||
addStressTooltip(state, tooltip, (KineticTileEntity) te);
|
||||
|
||||
if (tooltip.isEmpty())
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
Screen tooltipScreen = new Screen(null) {
|
||||
|
||||
@Override
|
||||
public void init(Minecraft mc, int width, int height) {
|
||||
this.minecraft = mc;
|
||||
this.itemRenderer = mc.getItemRenderer();
|
||||
this.font = mc.fontRenderer;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
tooltipScreen.init(mc, mc.mainWindow.getScaledWidth(), mc.mainWindow.getScaledHeight());
|
||||
tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
||||
ScreenElementRenderer.render3DItem(() -> {
|
||||
GlStateManager.translated(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16, 0);
|
||||
return goggles;
|
||||
});
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
}
|
||||
|
||||
private static void addStressTooltip(BlockState state, List<String> tooltip, KineticTileEntity te) {
|
||||
String spacing = " ";
|
||||
float stressApplied = te.getStressApplied();
|
||||
if (stressApplied == 0)
|
||||
return;
|
||||
|
||||
tooltip.add(spacing + Lang.translate("gui.goggles.kinetic_stats"));
|
||||
tooltip.add(spacing + GRAY + Lang.translate("tooltip.stressImpact"));
|
||||
String addedCapacity = TextFormatting.AQUA + "" + stressApplied + Lang.translate("generic.unit.stress") + " "
|
||||
+ DARK_GRAY + Lang.translate("gui.goggles.at_current_speed");
|
||||
tooltip.add(spacing + " " + addedCapacity);
|
||||
}
|
||||
|
||||
private static void addGeneratorTooltip(BlockState state, List<String> tooltip, GeneratingKineticTileEntity te) {
|
||||
String spacing = " ";
|
||||
float addedStressCapacity = te.getAddedStressCapacity();
|
||||
if (addedStressCapacity == 0)
|
||||
return;
|
||||
|
||||
tooltip.add(spacing + Lang.translate("gui.goggles.generator_stats"));
|
||||
tooltip.add(spacing + GRAY + Lang.translate("tooltip.capacityProvided"));
|
||||
|
||||
float actualSpeed = Math.abs(te.speed);
|
||||
float relativeCap = 0;
|
||||
if (actualSpeed != 0)
|
||||
relativeCap = addedStressCapacity * actualSpeed;
|
||||
|
||||
String addedCapacity = TextFormatting.AQUA + "" + addedStressCapacity + Lang.translate("generic.unit.stress")
|
||||
+ " " + DARK_GRAY + Lang.translate("gui.goggles.at_current_speed");
|
||||
String addedCapacityAtBase = GRAY + "" + (relativeCap) + Lang.translate("generic.unit.stress") + " " + DARK_GRAY
|
||||
+ Lang.translate("gui.goggles.base_value");
|
||||
tooltip.add(spacing + " " + addedCapacity);
|
||||
tooltip.add(spacing + " " + addedCapacityAtBase);
|
||||
}
|
||||
|
||||
private static void addGaugeTooltip(BlockState state, List<String> tooltip, TileEntity te) {
|
||||
String spacing = " ";
|
||||
tooltip.add(spacing + Lang.translate("gui.gauge.info_header"));
|
||||
|
||||
if (AllBlocks.STRESS_GAUGE.typeOf(state)) {
|
||||
if (!(te instanceof StressGaugeTileEntity))
|
||||
return;
|
||||
StressGaugeTileEntity stressGauge = (StressGaugeTileEntity) te;
|
||||
List<String> stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high");
|
||||
double stress = stressGauge.currentStress;
|
||||
double cap = stressGauge.maxStress;
|
||||
double relStress = stress / (cap == 0 ? 1 : cap);
|
||||
StressImpact impactId = relStress > 1 ? null
|
||||
: (relStress > .75f) ? StressImpact.HIGH
|
||||
: (relStress > .5f ? StressImpact.MEDIUM : StressImpact.LOW);
|
||||
|
||||
TextFormatting color = TextFormatting.RED;
|
||||
if (impactId == StressImpact.LOW)
|
||||
color = TextFormatting.GREEN;
|
||||
if (impactId == StressImpact.MEDIUM)
|
||||
color = TextFormatting.YELLOW;
|
||||
if (impactId == StressImpact.HIGH)
|
||||
color = TextFormatting.GOLD;
|
||||
|
||||
String level = TextFormatting.DARK_RED + ItemDescription.makeProgressBar(3, 2) + ""
|
||||
+ Lang.translate("gui.stress_gauge.overstressed");
|
||||
if (impactId != null) {
|
||||
int index = impactId.ordinal();
|
||||
level = color + ItemDescription.makeProgressBar(3, index) + stressLevels.get(index);
|
||||
}
|
||||
|
||||
level += " (" + (int) (relStress * 100) + "%)";
|
||||
|
||||
float actualSpeed = stressGauge.speed;
|
||||
if (actualSpeed == 0)
|
||||
level = DARK_GRAY + ItemDescription.makeProgressBar(3, -1)
|
||||
+ Lang.translate("gui.stress_gauge.no_rotation");
|
||||
|
||||
tooltip.add(spacing + GRAY + Lang.translate("gui.stress_gauge.title"));
|
||||
tooltip.add(spacing + level);
|
||||
|
||||
if (actualSpeed != 0) {
|
||||
tooltip.add(spacing + GRAY + Lang.translate("gui.stress_gauge.capacity"));
|
||||
|
||||
String capacity = color + "" + ((cap - stress) / Math.abs(actualSpeed))
|
||||
+ Lang.translate("generic.unit.stress") + " " + DARK_GRAY
|
||||
+ Lang.translate("gui.goggles.at_current_speed");
|
||||
String capacityAtBase = GRAY + "" + (cap - stress) + Lang.translate("generic.unit.stress") + " " + DARK_GRAY
|
||||
+ Lang.translate("gui.goggles.base_value");
|
||||
tooltip.add(spacing + " " + capacity);
|
||||
tooltip.add(spacing + " " + capacityAtBase);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (AllBlocks.SPEED_GAUGE.typeOf(state)) {
|
||||
if (!(te instanceof SpeedGaugeTileEntity))
|
||||
return;
|
||||
SpeedGaugeTileEntity speedGauge = (SpeedGaugeTileEntity) te;
|
||||
boolean overstressed = speedGauge.currentStress > speedGauge.maxStress && speedGauge.speed != 0;
|
||||
|
||||
SpeedLevel speedLevel = SpeedLevel.of(speedGauge.speed);
|
||||
String color = speedLevel.getTextColor() + "";
|
||||
if (overstressed)
|
||||
color = DARK_GRAY + "" + TextFormatting.STRIKETHROUGH;
|
||||
|
||||
List<String> speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high");
|
||||
int index = speedLevel.ordinal();
|
||||
String level = color + ItemDescription.makeProgressBar(3, index)
|
||||
+ (speedLevel != SpeedLevel.NONE ? speedLevels.get(index) : "");
|
||||
level += " (" + Math.abs(speedGauge.speed) + "" + Lang.translate("generic.unit.rpm") + ") ";
|
||||
|
||||
tooltip.add(spacing + GRAY + Lang.translate("gui.speed_gauge.title"));
|
||||
tooltip.add(spacing + level);
|
||||
|
||||
if (overstressed)
|
||||
tooltip.add(spacing + TextFormatting.DARK_RED + Lang.translate("gui.stress_gauge.overstressed"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@ public class GearboxTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
BlockState state = defaultState.with(BlockStateProperties.FACING, direction);
|
||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||
float angle = (time * te.getSpeed()) % 360;
|
||||
float angle = (time * te.getSpeed() * 3f / 10) % 360;
|
||||
|
||||
if (te.getSpeed() != 0 && te.hasSource()) {
|
||||
BlockPos source = te.getSource().subtract(te.getPos());
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHan
|
|||
Minecraft mc = Minecraft.getInstance();
|
||||
float pt = mc.getRenderPartialTicks();
|
||||
float progress = (float) ((mc.player.getYaw(pt)) / 180 * Math.PI)
|
||||
+ (AnimationTickHolder.getRenderTick() * 1f);
|
||||
+ (AnimationTickHolder.getRenderTick() / 10f);
|
||||
if (layer == 0)
|
||||
return ColorHelper.mixColors(0x6e5773, 0x6B3074, ((float) MathHelper.sin(progress) + 1) / 2);
|
||||
if (layer == 1)
|
||||
|
|
|
@ -31,7 +31,7 @@ public class BlockzapperItemRenderer extends ItemStackTileEntityRenderer {
|
|||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
BlockzapperModel mainModel = (BlockzapperModel) itemRenderer.getModelWithOverrides(stack);
|
||||
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
||||
float worldTime = AnimationTickHolder.getRenderTick();
|
||||
float worldTime = AnimationTickHolder.getRenderTick() / 20;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class DeforesterItemRenderer extends ItemStackTileEntityRenderer {
|
|||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
||||
GlStateManager.enableLighting();
|
||||
|
||||
float angle = worldTime * -10 % 360;
|
||||
float angle = worldTime * -.5f % 360;
|
||||
float xOffset = 0;
|
||||
float zOffset = 0;
|
||||
GlStateManager.translatef(-xOffset, 0, -zOffset);
|
||||
|
|
|
@ -17,7 +17,7 @@ public class SymmetryWandItemRenderer extends ItemStackTileEntityRenderer {
|
|||
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
SymmetryWandModel mainModel = (SymmetryWandModel) itemRenderer.getModelWithOverrides(stack);
|
||||
float worldTime = AnimationTickHolder.getRenderTick();
|
||||
float worldTime = AnimationTickHolder.getRenderTick() / 20;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
|
|
|
@ -51,6 +51,17 @@ public class SandPaperItem extends Item {
|
|||
return new ActionResult<>(ActionResultType.PASS, itemstack);
|
||||
}
|
||||
|
||||
Hand otherHand = handIn == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND;
|
||||
ItemStack itemInOtherHand = playerIn.getHeldItem(otherHand);
|
||||
if (SandPaperPolishingRecipe.canPolish(worldIn, itemInOtherHand)) {
|
||||
ItemStack item = itemInOtherHand.copy();
|
||||
ItemStack toPolish = item.split(1);
|
||||
playerIn.setActiveHand(handIn);
|
||||
itemstack.getOrCreateTag().put("Polishing", toPolish.serializeNBT());
|
||||
playerIn.setHeldItem(otherHand, item);
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, itemstack);
|
||||
}
|
||||
|
||||
RayTraceResult raytraceresult = rayTrace(worldIn, playerIn, RayTraceContext.FluidMode.NONE);
|
||||
if (!(raytraceresult instanceof BlockRayTraceResult))
|
||||
return FAIL;
|
||||
|
|
|
@ -266,6 +266,8 @@
|
|||
"create.generic.unit.ticks": "Ticks",
|
||||
"create.generic.unit.seconds": "Seconds",
|
||||
"create.generic.unit.minutes": "Minutes",
|
||||
"create.generic.unit.rpm": "rpm",
|
||||
"create.generic.unit.stress": "sU",
|
||||
|
||||
"create.action.scroll": "Scroll",
|
||||
"create.action.confirm": "Confirm",
|
||||
|
@ -325,6 +327,18 @@
|
|||
"create.logistics.firstFrequency": "Freq. #1",
|
||||
"create.logistics.secondFrequency": "Freq. #2",
|
||||
|
||||
"create.gui.goggles.generator_stats": "Generator Stats:",
|
||||
"create.gui.goggles.kinetic_stats": "Kinetic Stats:",
|
||||
"create.gui.goggles.at_current_speed": "At current Speed",
|
||||
"create.gui.goggles.base_value": "Base Value",
|
||||
|
||||
"create.gui.gauge.info_header": "Gauge Information:",
|
||||
"create.gui.speed_gauge.title": "Rotation Speed",
|
||||
"create.gui.stress_gauge.title": "Network Stress",
|
||||
"create.gui.stress_gauge.capacity": "Remaining Capacity",
|
||||
"create.gui.stress_gauge.overstressed": "Overstressed",
|
||||
"create.gui.stress_gauge.no_rotation": "No Rotation",
|
||||
|
||||
"create.gui.flexcrate.title": "Adjustable Crate",
|
||||
"create.gui.flexcrate.storageSpace": "Storage Space",
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
"count": 1
|
||||
}
|
||||
],
|
||||
"processingTime": 50
|
||||
"processingTime": 250
|
||||
}
|
|
@ -22,5 +22,5 @@
|
|||
"chance": 0.2
|
||||
}
|
||||
],
|
||||
"processingTime": 50
|
||||
"processingTime": 250
|
||||
}
|
|
@ -22,5 +22,5 @@
|
|||
"chance": 0.05
|
||||
}
|
||||
],
|
||||
"processingTime": 50
|
||||
"processingTime": 150
|
||||
}
|
Loading…
Reference in a new issue