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";
|
name = "fanRotationArgmax";
|
||||||
fanRotationArgmax = builder.comment("", "Rotation speed at which the maximum stats of fans are reached.")
|
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";
|
name = "generatingFanSpeed";
|
||||||
generatingFanSpeed = builder.comment("", "Rotation speed generated by a vertical fan above fire.")
|
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";
|
name = "inWorldProcessingTime";
|
||||||
inWorldProcessingTime = builder
|
inWorldProcessingTime = builder
|
||||||
|
@ -259,11 +259,11 @@ public class CreateConfig {
|
||||||
|
|
||||||
name = "maxMotorSpeed";
|
name = "maxMotorSpeed";
|
||||||
maxMotorSpeed = builder.comment("", "Maximum allowed speed of a configurable motor.")
|
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";
|
name = "maxRotationSpeed";
|
||||||
maxRotationSpeed = builder.comment("", "Maximum allowed rotation speed for any Kinetic Tile.")
|
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();
|
builder.pop();
|
||||||
}
|
}
|
||||||
|
@ -369,11 +369,11 @@ public class CreateConfig {
|
||||||
|
|
||||||
name = "mediumSpeed";
|
name = "mediumSpeed";
|
||||||
mediumSpeed = builder.comment("", "[in Degrees/Tick]", "Minimum speed of rotation to be considered 'medium'")
|
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";
|
name = "fastSpeed";
|
||||||
fastSpeed = builder.comment("", "[in Degrees/Tick]", "Minimum speed of rotation to be considered 'fast'")
|
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";
|
name = "mediumStressImpact";
|
||||||
mediumStressImpact = builder.comment("", "Minimum stress impact to be considered 'medium'")
|
mediumStressImpact = builder.comment("", "Minimum stress impact to be considered 'medium'")
|
||||||
|
@ -419,11 +419,11 @@ public class CreateConfig {
|
||||||
String basePath = "create.config.stress.";
|
String basePath = "create.config.stress.";
|
||||||
String name = block.name();
|
String name = block.name();
|
||||||
stressEntries.put(block.get().getRegistryName(), builder.comment("").translation(basePath + 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) {
|
private void initStressCapacityEntry(AllBlocks block, final ForgeConfigSpec.Builder builder) {
|
||||||
double defaultStressCapacity = getDefaultStressCapacity(block);
|
double defaultStressCapacity = StressConfigDefaults.getDefaultStressCapacity(block);
|
||||||
if (defaultStressCapacity == -1)
|
if (defaultStressCapacity == -1)
|
||||||
return;
|
return;
|
||||||
String basePath = "create.config.stressCapacity.";
|
String basePath = "create.config.stressCapacity.";
|
||||||
|
@ -432,66 +432,6 @@ public class CreateConfig {
|
||||||
builder.comment("").translation(basePath + name).defineInRange(name, defaultStressCapacity, 0, 4096D));
|
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) {
|
private boolean isValidPath(Object path) {
|
||||||
if (!(path instanceof String))
|
if (!(path instanceof String))
|
||||||
return false;
|
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.CommandDispatcher;
|
||||||
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.command.Commands;
|
import net.minecraft.command.Commands;
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,16 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.contraptions.base.IRotate;
|
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.SpeedLevel;
|
||||||
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
|
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.inventory.EquipmentSlotType;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
@ -80,17 +83,26 @@ public class ItemDescription {
|
||||||
SpeedLevel minimumRequiredSpeedLevel = block.getMinimumRequiredSpeedLevel();
|
SpeedLevel minimumRequiredSpeedLevel = block.getMinimumRequiredSpeedLevel();
|
||||||
boolean hasSpeedRequirement = minimumRequiredSpeedLevel != SpeedLevel.NONE;
|
boolean hasSpeedRequirement = minimumRequiredSpeedLevel != SpeedLevel.NONE;
|
||||||
ResourceLocation id = ((Block) block).getRegistryName();
|
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 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) {
|
if (hasSpeedRequirement) {
|
||||||
List<String> speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high");
|
List<String> speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high");
|
||||||
int index = minimumRequiredSpeedLevel.ordinal();
|
int index = minimumRequiredSpeedLevel.ordinal();
|
||||||
String level = minimumRequiredSpeedLevel.getTextColor() + makeProgressBar(3, index)
|
String level = minimumRequiredSpeedLevel.getTextColor() + makeProgressBar(3, index)
|
||||||
+ speedLevels.get(index);
|
+ speedLevels.get(index);
|
||||||
|
|
||||||
|
if (hasGlasses)
|
||||||
|
level += " (" + minimumRequiredSpeedLevel.getSpeedValue() + rpmUnit + "+)";
|
||||||
|
|
||||||
add(linesOnShift, GRAY + Lang.translate("tooltip.speedRequirement"));
|
add(linesOnShift, GRAY + Lang.translate("tooltip.speedRequirement"));
|
||||||
add(linesOnShift, level);
|
add(linesOnShift, level);
|
||||||
}
|
}
|
||||||
|
String stressUnit = Lang.translate("generic.unit.stress");
|
||||||
if (hasStressImpact && !block.hideStressImpact()) {
|
if (hasStressImpact && !block.hideStressImpact()) {
|
||||||
List<String> stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high");
|
List<String> stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high");
|
||||||
double impact = parameters.stressEntries.get(id).get();
|
double impact = parameters.stressEntries.get(id).get();
|
||||||
|
@ -98,6 +110,10 @@ public class ItemDescription {
|
||||||
: (impact >= parameters.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW);
|
: (impact >= parameters.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW);
|
||||||
int index = impactId.ordinal();
|
int index = impactId.ordinal();
|
||||||
String level = impactId.getColor() + makeProgressBar(3, index) + stressLevels.get(index);
|
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, GRAY + Lang.translate("tooltip.stressImpact"));
|
||||||
add(linesOnShift, level);
|
add(linesOnShift, level);
|
||||||
|
|
||||||
|
@ -110,6 +126,9 @@ public class ItemDescription {
|
||||||
: (capacity >= parameters.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH);
|
: (capacity >= parameters.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH);
|
||||||
int index = StressImpact.values().length - 1 - impactId.ordinal();
|
int index = StressImpact.values().length - 1 - impactId.ordinal();
|
||||||
String level = impactId.getColor() + makeProgressBar(3, index) + stressCapacityLevels.get(index);
|
String level = impactId.getColor() + makeProgressBar(3, index) + stressCapacityLevels.get(index);
|
||||||
|
|
||||||
|
if (hasGlasses)
|
||||||
|
level += " (" + capacity + stressUnit + ")";
|
||||||
if (block.showCapacityWithAnnotation())
|
if (block.showCapacityWithAnnotation())
|
||||||
level += " " + DARK_GRAY + TextFormatting.ITALIC
|
level += " " + DARK_GRAY + TextFormatting.ITALIC
|
||||||
+ Lang.translate("tooltip.capacityProvided.asGenerator");
|
+ Lang.translate("tooltip.capacityProvided.asGenerator");
|
||||||
|
@ -123,7 +142,7 @@ public class ItemDescription {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String makeProgressBar(int length, int filledLength) {
|
public static String makeProgressBar(int length, int filledLength) {
|
||||||
String bar = " ";
|
String bar = " ";
|
||||||
int emptySpaces = length - 1 - filledLength;
|
int emptySpaces = length - 1 - filledLength;
|
||||||
for (int i = 0; i <= filledLength; i++)
|
for (int i = 0; i <= filledLength; i++)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.mojang.bridge.game.Language;
|
import com.mojang.bridge.game.Language;
|
||||||
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.foundation.item.ItemDescription.Palette;
|
import com.simibubi.create.foundation.item.ItemDescription.Palette;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.IModule;
|
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.Minecraft;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.inventory.EquipmentSlotType;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
@ -24,6 +26,7 @@ public class TooltipHelper {
|
||||||
public static final int maxCharsPerLine = 35;
|
public static final int maxCharsPerLine = 35;
|
||||||
public static final Map<String, ItemDescription> cachedTooltips = new HashMap<>();
|
public static final Map<String, ItemDescription> cachedTooltips = new HashMap<>();
|
||||||
public static Language cachedLanguage;
|
public static Language cachedLanguage;
|
||||||
|
private static boolean gogglesMode;
|
||||||
|
|
||||||
public static String holdShift(Palette color, boolean highlighted) {
|
public static String holdShift(Palette color, boolean highlighted) {
|
||||||
TextFormatting colorFormat = highlighted ? color.hColor : color.color;
|
TextFormatting colorFormat = highlighted ? color.hColor : color.color;
|
||||||
|
@ -81,7 +84,13 @@ public class TooltipHelper {
|
||||||
|
|
||||||
public static boolean hasTooltip(ItemStack stack) {
|
public static boolean hasTooltip(ItemStack stack) {
|
||||||
checkLocale();
|
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);
|
String key = getTooltipTranslationKey(stack);
|
||||||
if (cachedTooltips.containsKey(key))
|
if (cachedTooltips.containsKey(key))
|
||||||
return cachedTooltips.get(key) != ItemDescription.MISSING;
|
return cachedTooltips.get(key) != ItemDescription.MISSING;
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class AnimationTickHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getRenderTick() {
|
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 java.util.List;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.simibubi.create.Create;
|
|
||||||
import com.simibubi.create.CreateClientConfig;
|
import com.simibubi.create.CreateClientConfig;
|
||||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
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);
|
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||||
itemRenderer.renderItem(stack, mainModel.getBakedModel());
|
itemRenderer.renderItem(stack, mainModel.getBakedModel());
|
||||||
|
|
||||||
float angle = worldTime * -10 % 360;
|
float angle = worldTime * -.5f % 360;
|
||||||
|
|
||||||
float xOffset = -1/32f;
|
float xOffset = -1/32f;
|
||||||
float zOffset = 0;
|
float zOffset = 0;
|
||||||
|
|
|
@ -23,7 +23,7 @@ public interface IRotate extends IWrenchable {
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
return this == NONE ? 0x22FF22 : this == MEDIUM ? 0x0084FF : 0xFF55FF;
|
return this == NONE ? 0x22FF22 : this == MEDIUM ? 0x0084FF : 0xFF55FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getParticleSpeed() {
|
public int getParticleSpeed() {
|
||||||
return this == NONE ? 10 : this == MEDIUM ? 20 : 30;
|
return this == NONE ? 10 : this == MEDIUM ? 20 : 30;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,19 @@ public interface IRotate extends IWrenchable {
|
||||||
}
|
}
|
||||||
return NONE;
|
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 {
|
public enum StressImpact {
|
||||||
|
@ -57,11 +70,11 @@ public interface IRotate extends IWrenchable {
|
||||||
public default SpeedLevel getMinimumRequiredSpeedLevel() {
|
public default SpeedLevel getMinimumRequiredSpeedLevel() {
|
||||||
return SpeedLevel.NONE;
|
return SpeedLevel.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public default boolean hideStressImpact() {
|
public default boolean hideStressImpact() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public default boolean showCapacityWithAnnotation() {
|
public default boolean showCapacityWithAnnotation() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
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.ITickableTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
@ -48,12 +49,14 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
||||||
public float maxStress;
|
public float maxStress;
|
||||||
public float currentStress;
|
public float currentStress;
|
||||||
protected boolean overStressed;
|
protected boolean overStressed;
|
||||||
|
|
||||||
public UUID networkID;
|
public UUID networkID;
|
||||||
public UUID newNetworkID;
|
public UUID newNetworkID;
|
||||||
public boolean updateNetwork;
|
public boolean updateNetwork;
|
||||||
protected boolean initNetwork;
|
protected boolean initNetwork;
|
||||||
|
|
||||||
|
// Client
|
||||||
|
float overStressedEffect;
|
||||||
|
|
||||||
public KineticTileEntity(TileEntityType<?> typeIn) {
|
public KineticTileEntity(TileEntityType<?> typeIn) {
|
||||||
super(typeIn);
|
super(typeIn);
|
||||||
speed = 0;
|
speed = 0;
|
||||||
|
@ -161,6 +164,21 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
||||||
super.read(compound);
|
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() {
|
public boolean isSource() {
|
||||||
return getGeneratedSpeed() != 0;
|
return getGeneratedSpeed() != 0;
|
||||||
}
|
}
|
||||||
|
@ -177,15 +195,6 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
||||||
|
|
||||||
public void setSpeed(float speed) {
|
public void setSpeed(float speed) {
|
||||||
this.speed = 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() {
|
public boolean hasSource() {
|
||||||
|
@ -274,8 +283,15 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
if (world.isRemote)
|
if (world.isRemote) {
|
||||||
|
if (overStressedEffect != 0) {
|
||||||
|
overStressedEffect -= overStressedEffect * .1f;
|
||||||
|
if (Math.abs(overStressedEffect) < 1 / 128f)
|
||||||
|
overStressedEffect = 0;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (speedChangeCounter > 0)
|
if (speedChangeCounter > 0)
|
||||||
speedChangeCounter--;
|
speedChangeCounter--;
|
||||||
|
|
||||||
|
@ -344,6 +360,19 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
||||||
particleSpawnCountdown = 2;
|
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() {
|
protected void spawnRotationIndicators() {
|
||||||
if (getSpeed() == 0)
|
if (getSpeed() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast<KineticTil
|
||||||
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
|
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
|
||||||
float time = AnimationTickHolder.getRenderTick();
|
float time = AnimationTickHolder.getRenderTick();
|
||||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
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;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,12 +55,21 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast<KineticTil
|
||||||
buffer.light(packedLightmapCoords);
|
buffer.light(packedLightmapCoords);
|
||||||
buffer.rotateCentered(axis, angle);
|
buffer.rotateCentered(axis, angle);
|
||||||
|
|
||||||
|
int white = 0xFFFFFF;
|
||||||
if (KineticDebugger.isActive()) {
|
if (KineticDebugger.isActive()) {
|
||||||
rainbowMode = true;
|
rainbowMode = true;
|
||||||
if (te.hasNetwork())
|
if (te.hasNetwork())
|
||||||
buffer.color(ColorHelper.colorFromUUID(te.getNetworkID()));
|
buffer.color(ColorHelper.colorFromUUID(te.getNetworkID()));
|
||||||
else
|
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;
|
return buffer;
|
||||||
|
|
|
@ -144,7 +144,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float getBreakSpeed() {
|
protected float getBreakSpeed() {
|
||||||
return Math.abs(speed / 100f);
|
return Math.abs(getSpeed() / 100f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class DrillTileEntityRenderer extends KineticTileEntityRenderer {
|
||||||
? context.getAnimationSpeed()
|
? context.getAnimationSpeed()
|
||||||
: 0);
|
: 0);
|
||||||
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
|
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);
|
float angle = (float) (((time * speed) % 360) / 180 * (float) Math.PI);
|
||||||
|
|
||||||
return buffer.rotateCentered(axis, angle);
|
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())
|
float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, state.get(HORIZONTAL_FACING).getOpposite())
|
||||||
? context.getAnimationSpeed() * state.get(HORIZONTAL_FACING).getAxisDirection().getOffset()
|
? context.getAnimationSpeed() * state.get(HORIZONTAL_FACING).getAxisDirection().getOffset()
|
||||||
: 0);
|
: 0);
|
||||||
float time = AnimationTickHolder.getRenderTick();
|
float time = AnimationTickHolder.getRenderTick() / 20;
|
||||||
float angle = (float) (((time * speed) % 360) / 180 * (float) Math.PI);
|
float angle = (float) (((time * speed) % 360) / 180 * (float) Math.PI);
|
||||||
|
|
||||||
return renderHead(context.world, BlockPos.ZERO, state, angle);
|
return renderHead(context.world, BlockPos.ZERO, state, angle);
|
||||||
|
|
|
@ -30,6 +30,11 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
public float getAddedStressCapacity() {
|
public float getAddedStressCapacity() {
|
||||||
return isWindmill ? super.getAddedStressCapacity() : 0;
|
return isWindmill ? super.getAddedStressCapacity() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStressApplied() {
|
||||||
|
return isWindmill ? 0 : super.getStressApplied();
|
||||||
|
}
|
||||||
|
|
||||||
public void neighbourChanged() {
|
public void neighbourChanged() {
|
||||||
boolean shouldWindmill = world.isBlockPowered(pos);
|
boolean shouldWindmill = world.isBlockPowered(pos);
|
||||||
|
@ -64,8 +69,8 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
return 0;
|
return 0;
|
||||||
if (movedContraption == null)
|
if (movedContraption == null)
|
||||||
return 0;
|
return 0;
|
||||||
int sails = ((BearingContraption) movedContraption.getContraption()).getSailBlocks();
|
int sails = ((BearingContraption) movedContraption.getContraption()).getSailBlocks() / 8;
|
||||||
return MathHelper.clamp(sails, 0, 128);
|
return MathHelper.clamp(sails, 1, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,7 +100,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getAngularSpeed() {
|
public float getAngularSpeed() {
|
||||||
return getSpeed() / 2048;
|
return getSpeed() * 3 / 10f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assembleConstruct() {
|
public void assembleConstruct() {
|
||||||
|
@ -143,7 +148,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
if (!world.isRemote && assembleNextTick) {
|
if (!world.isRemote && assembleNextTick) {
|
||||||
assembleNextTick = false;
|
assembleNextTick = false;
|
||||||
if (running) {
|
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
|
if (speed == 0 && (canDisassemble || movedContraption == null
|
||||||
|| movedContraption.getContraption().blocks.isEmpty())) {
|
|| movedContraption.getContraption().blocks.isEmpty())) {
|
||||||
disassembleConstruct();
|
disassembleConstruct();
|
||||||
|
@ -162,14 +167,14 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
|
|
||||||
float angularSpeed = getAngularSpeed();
|
float angularSpeed = getAngularSpeed();
|
||||||
float newAngle = angle + angularSpeed;
|
float newAngle = angle + angularSpeed;
|
||||||
angle = (float) (newAngle % (2 * Math.PI));
|
angle = (float) (newAngle % 360);
|
||||||
applyRotation();
|
applyRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyRotation() {
|
private void applyRotation() {
|
||||||
if (movedContraption != null) {
|
if (movedContraption != null) {
|
||||||
Direction direction = getBlockState().get(BlockStateProperties.FACING);
|
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);
|
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);
|
SuperByteBuffer superBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, capState);
|
||||||
float interpolatedAngle = bearingTe.getInterpolatedAngle(partialTicks);
|
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);
|
superBuffer.translate(x, y, z).renderInto(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ public class MechanicalPistonTileEntity extends KineticTileEntity implements ICo
|
||||||
Direction pistonDirection = getBlockState().get(BlockStateProperties.FACING);
|
Direction pistonDirection = getBlockState().get(BlockStateProperties.FACING);
|
||||||
int movementModifier = pistonDirection.getAxisDirection().getOffset()
|
int movementModifier = pistonDirection.getAxisDirection().getOffset()
|
||||||
* (pistonDirection.getAxis() == Axis.Z ? -1 : 1);
|
* (pistonDirection.getAxis() == Axis.Z ? -1 : 1);
|
||||||
return getSpeed() * -movementModifier / 1024f;
|
return getSpeed() * -movementModifier / 512f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3d getConstructOffset(float partialTicks) {
|
public Vec3d getConstructOffset(float partialTicks) {
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
||||||
public int getCountDownSpeed() {
|
public int getCountDownSpeed() {
|
||||||
if (getSpeed() == 0)
|
if (getSpeed() == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return MathHelper.clamp((int) Math.abs(getSpeed() / 2), 1, 250);
|
return MathHelper.clamp((int) Math.abs(getSpeed()), 4, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,17 +9,17 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity {
|
||||||
public boolean backwards;
|
public boolean backwards;
|
||||||
public float independentAngle;
|
public float independentAngle;
|
||||||
public float chasingVelocity;
|
public float chasingVelocity;
|
||||||
|
|
||||||
public HandCrankTileEntity() {
|
public HandCrankTileEntity() {
|
||||||
super(AllTileEntities.HAND_CRANK.type);
|
super(AllTileEntities.HAND_CRANK.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void turn(boolean back) {
|
public void turn(boolean back) {
|
||||||
boolean update = false;
|
boolean update = false;
|
||||||
|
|
||||||
if (getGeneratedSpeed() == 0 || back != backwards)
|
if (getGeneratedSpeed() == 0 || back != backwards)
|
||||||
update = true;
|
update = true;
|
||||||
|
|
||||||
inUse = 10;
|
inUse = 10;
|
||||||
this.backwards = back;
|
this.backwards = back;
|
||||||
if (update && !world.isRemote)
|
if (update && !world.isRemote)
|
||||||
|
@ -28,21 +28,21 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getGeneratedSpeed() {
|
public float getGeneratedSpeed() {
|
||||||
return inUse == 0 ? 0 : backwards ? -128 : 128;
|
return inUse == 0 ? 0 : backwards ? -32 : 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
float actualSpeed = getSpeed();
|
float actualSpeed = getSpeed();
|
||||||
chasingVelocity += (actualSpeed - chasingVelocity) * .25f;
|
chasingVelocity += ((actualSpeed * 10 / 3f) - chasingVelocity) * .25f;
|
||||||
independentAngle += chasingVelocity;
|
independentAngle += chasingVelocity;
|
||||||
|
|
||||||
if (inUse > 0) {
|
if (inUse > 0) {
|
||||||
inUse--;
|
inUse--;
|
||||||
|
|
||||||
if (inUse == 0 && !world.isRemote)
|
if (inUse == 0 && !world.isRemote)
|
||||||
updateGeneratedRotation();
|
updateGeneratedRotation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.InventoryHelper;
|
import net.minecraft.inventory.InventoryHelper;
|
||||||
import net.minecraft.item.BlockItemUseContext;
|
import net.minecraft.item.BlockItemUseContext;
|
||||||
|
@ -81,9 +82,13 @@ public class CrushingWheelControllerBlock extends Block implements IHaveNoBlockI
|
||||||
if (!(tileEntity instanceof CrushingWheelControllerTileEntity))
|
if (!(tileEntity instanceof CrushingWheelControllerTileEntity))
|
||||||
return;
|
return;
|
||||||
CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) tileEntity;
|
CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) tileEntity;
|
||||||
|
if (te.crushingspeed == 0)
|
||||||
|
return;
|
||||||
|
if (entityIn instanceof ItemEntity)
|
||||||
|
((ItemEntity) entityIn).setPickupDelay(10);
|
||||||
if (te.isOccupied())
|
if (te.isOccupied())
|
||||||
return;
|
return;
|
||||||
if ((entityIn instanceof PlayerEntity) && ((PlayerEntity) entityIn).isCreative())
|
if ((entityIn instanceof PlayerEntity) && ((PlayerEntity) entityIn).isCreative())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
te.startCrushing(entityIn);
|
te.startCrushing(entityIn);
|
||||||
|
@ -167,16 +172,15 @@ public class CrushingWheelControllerBlock extends Block implements IHaveNoBlockI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
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 (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);
|
worldIn.removeTileEntity(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import net.minecraft.particles.ItemParticleData;
|
||||||
import net.minecraft.particles.ParticleTypes;
|
import net.minecraft.particles.ParticleTypes;
|
||||||
import net.minecraft.tileentity.ITickableTileEntity;
|
import net.minecraft.tileentity.ITickableTileEntity;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public class CrushingWheelControllerTileEntity extends SyncedTileEntity implements ITickableTileEntity {
|
public class CrushingWheelControllerTileEntity extends SyncedTileEntity implements ITickableTileEntity {
|
||||||
|
@ -59,12 +60,14 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen
|
||||||
if (crushingspeed == 0)
|
if (crushingspeed == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float speed = crushingspeed / 2.5f;
|
float speed = crushingspeed * 4;
|
||||||
Vec3d outPos = VecHelper.getCenterOf(pos);
|
Vec3d outPos = VecHelper.getCenterOf(pos);
|
||||||
|
|
||||||
if (!hasEntity()) {
|
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;
|
inventory.remainingTime -= processingSpeed;
|
||||||
spawnParticles(inventory.getStackInSlot(0));
|
spawnParticles(inventory.getStackInSlot(0));
|
||||||
|
|
||||||
|
@ -122,6 +125,7 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemEntity itemEntity = (ItemEntity) processingEntity;
|
ItemEntity itemEntity = (ItemEntity) processingEntity;
|
||||||
|
itemEntity.setPickupDelay(20);
|
||||||
if (processingEntity.posY < pos.getY() + .25f) {
|
if (processingEntity.posY < pos.getY() + .25f) {
|
||||||
insertItem(itemEntity);
|
insertItem(itemEntity);
|
||||||
itemEntity.remove();
|
itemEntity.remove();
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getTimerSpeed() {
|
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
|
@Override
|
||||||
|
|
|
@ -22,10 +22,12 @@ import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -53,23 +55,24 @@ public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileE
|
||||||
|
|
||||||
Direction facing = deployerState.get(FACING);
|
Direction facing = deployerState.get(FACING);
|
||||||
boolean punching = te.mode == Mode.PUNCH;
|
boolean punching = te.mode == Mode.PUNCH;
|
||||||
|
|
||||||
float yRot = AngleHelper.horizontalAngle(facing) + 180;
|
float yRot = AngleHelper.horizontalAngle(facing) + 180;
|
||||||
float zRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
|
float zRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
|
||||||
|
|
||||||
GlStateManager.rotatef(yRot, 0, 1, 0);
|
GlStateManager.rotatef(yRot, 0, 1, 0);
|
||||||
GlStateManager.rotatef(zRot, 1, 0, 0);
|
GlStateManager.rotatef(zRot, 1, 0, 0);
|
||||||
GlStateManager.translated(0, 0, -11 / 16f);
|
GlStateManager.translated(0, 0, -11 / 16f);
|
||||||
|
|
||||||
if (punching) {
|
if (punching)
|
||||||
GlStateManager.translatef(0, 1/8f, -1/16f);
|
GlStateManager.translatef(0, 1 / 8f, -1 / 16f);
|
||||||
// GlStateManager.rotatef(punching ? -45 : 0, 1, 0, 0);
|
|
||||||
}
|
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||||
|
boolean isBlockItem = (te.heldItem.getItem() instanceof BlockItem)
|
||||||
float scale = punching ? .75f : .5f;
|
&& itemRenderer.getModelWithOverrides(te.heldItem).isGui3d();
|
||||||
|
float scale = punching ? .75f : isBlockItem ? .75f - 1 / 64f : .5f;
|
||||||
GlStateManager.scaled(scale, scale, scale);
|
GlStateManager.scaled(scale, scale, scale);
|
||||||
TransformType transform = punching ? TransformType.THIRD_PERSON_RIGHT_HAND : TransformType.FIXED;
|
TransformType transform = punching ? TransformType.THIRD_PERSON_RIGHT_HAND : TransformType.FIXED;
|
||||||
Minecraft.getInstance().getItemRenderer().renderItem(te.heldItem, transform);
|
itemRenderer.renderItem(te.heldItem, transform);
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
@ -103,7 +106,7 @@ public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileE
|
||||||
|
|
||||||
float handLength = te.getHandPose() == AllBlocks.DEPLOYER_HAND_POINTING ? 0
|
float handLength = te.getHandPose() == AllBlocks.DEPLOYER_HAND_POINTING ? 0
|
||||||
: te.getHandPose() == AllBlocks.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
|
: 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);
|
Vec3d offset = new Vec3d(blockState.get(FACING).getDirectionVec()).scale(distance);
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,11 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity {
|
||||||
public float getAddedStressCapacity() {
|
public float getAddedStressCapacity() {
|
||||||
return isGenerator ? super.getAddedStressCapacity() : 0;
|
return isGenerator ? super.getAddedStressCapacity() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStressApplied() {
|
||||||
|
return isGenerator ? 0 : super.getStressApplied();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getGeneratedSpeed() {
|
public float getGeneratedSpeed() {
|
||||||
|
|
|
@ -21,12 +21,12 @@ public class EncasedFanTileEntityRenderer extends KineticTileEntityRenderer {
|
||||||
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||||
|
|
||||||
float time = AnimationTickHolder.getRenderTick();
|
float time = AnimationTickHolder.getRenderTick();
|
||||||
float speed = te.getSpeed() * 20;
|
float speed = te.getSpeed() * 5;
|
||||||
if (speed > 0)
|
if (speed > 0)
|
||||||
speed = MathHelper.clamp(speed, 80, 64 * 20);
|
speed = MathHelper.clamp(speed, 80, 64 * 20);
|
||||||
if (speed < 0)
|
if (speed < 0)
|
||||||
speed = MathHelper.clamp(speed, -64 * 20, -80);
|
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;
|
angle = angle / 180f * (float) Math.PI;
|
||||||
|
|
||||||
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE,
|
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE,
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
|
||||||
|
|
||||||
if (!world.isRemote && runningTicks == 20) {
|
if (!world.isRemote && runningTicks == 20) {
|
||||||
if (processingTicks < 0) {
|
if (processingTicks < 0) {
|
||||||
processingTicks = (MathHelper.log2((int) (8000 / speed))) * 15 + 1;
|
processingTicks = MathHelper.clamp((MathHelper.log2((int) (512 / speed))) * 15 + 1, 1, 512);
|
||||||
} else {
|
} else {
|
||||||
processingTicks--;
|
processingTicks--;
|
||||||
if (processingTicks == 0) {
|
if (processingTicks == 0) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class MechanicalMixerTileEntityRenderer extends KineticTileEntityRenderer
|
||||||
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
|
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
|
||||||
float speed = mixer.getRenderedHeadRotationSpeed(partialTicks);
|
float speed = mixer.getRenderedHeadRotationSpeed(partialTicks);
|
||||||
float time = AnimationTickHolder.getRenderTick();
|
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);
|
SuperByteBuffer poleRender = CreateClient.bufferCache.renderGenericBlockModel(poleState);
|
||||||
poleRender.translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords).renderInto(buffer);
|
poleRender.translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords).renderInto(buffer);
|
||||||
|
|
|
@ -74,13 +74,15 @@ public class MotorBlock extends HorizontalKineticBlock
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScroll(BlockState state, IWorld world, BlockPos pos, double delta) {
|
public void onScroll(BlockState state, IWorld world, BlockPos pos, double delta) {
|
||||||
withTileEntityDo(world, pos, te -> te
|
withTileEntityDo(world, pos, te -> {
|
||||||
.setSpeedValueLazily((int) (te.newGeneratedSpeed * (delta > 0 ^ te.newGeneratedSpeed < 0 ? 2 : .5f))));
|
int d = Math.abs(te.newGeneratedSpeed) < 32 ? 4 : 16;
|
||||||
|
te.setSpeedValueLazily((int) (te.newGeneratedSpeed + delta * d));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValueName(BlockState state, IWorld world, BlockPos pos) {
|
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
|
@Override
|
||||||
|
|
|
@ -53,12 +53,7 @@ public class MotorTileEntity extends GeneratingKineticTileEntity {
|
||||||
if (newGeneratedSpeed == speed)
|
if (newGeneratedSpeed == speed)
|
||||||
return;
|
return;
|
||||||
Integer max = CreateConfig.parameters.maxMotorSpeed.get();
|
Integer max = CreateConfig.parameters.maxMotorSpeed.get();
|
||||||
if (newGeneratedSpeed > 0 && speed == 0)
|
newGeneratedSpeed = MathHelper.clamp(speed, -max, max);
|
||||||
newGeneratedSpeed = -1;
|
|
||||||
else if (newGeneratedSpeed < 0 && speed == 0)
|
|
||||||
newGeneratedSpeed = 1;
|
|
||||||
else
|
|
||||||
newGeneratedSpeed = MathHelper.clamp(speed, -max, max);
|
|
||||||
this.lastModified = 0;
|
this.lastModified = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TurntableBlock extends KineticBlock {
|
||||||
if (e.getMotion().y > 0)
|
if (e.getMotion().y > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float speed = ((KineticTileEntity) te).getSpeed() / 20;
|
float speed = ((KineticTileEntity) te).getSpeed() * 3/10;
|
||||||
World world = e.getEntityWorld();
|
World world = e.getEntityWorld();
|
||||||
|
|
||||||
if (speed == 0)
|
if (speed == 0)
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class TurntableHandler {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
KineticTileEntity te = (KineticTileEntity) mc.world.getTileEntity(pos);
|
KineticTileEntity te = (KineticTileEntity) mc.world.getTileEntity(pos);
|
||||||
float speed = te.getSpeed() / 19;
|
float speed = te.getSpeed() * 3/10;
|
||||||
|
|
||||||
if (speed == 0)
|
if (speed == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock {
|
||||||
flow = flowVec.y > 0 ^ !clockwise ? -flowVec.y * clockwiseMultiplier : -flowVec.y;
|
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) {
|
private void updateWheelSpeed(IWorld world, BlockPos pos) {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import net.minecraftforge.items.ItemStackHandler;
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
public class ProcessingInventory extends RecipeWrapper implements IItemHandler {
|
public class ProcessingInventory extends RecipeWrapper implements IItemHandler {
|
||||||
public int remainingTime;
|
public float remainingTime;
|
||||||
public int recipeDuration;
|
public float recipeDuration;
|
||||||
public boolean appliedRecipe;
|
public boolean appliedRecipe;
|
||||||
|
|
||||||
public ProcessingInventory() {
|
public ProcessingInventory() {
|
||||||
|
@ -32,8 +32,8 @@ public class ProcessingInventory extends RecipeWrapper implements IItemHandler {
|
||||||
stacks.add(stack);
|
stacks.add(stack);
|
||||||
}
|
}
|
||||||
ItemStackHelper.saveAllItems(nbt, stacks);
|
ItemStackHelper.saveAllItems(nbt, stacks);
|
||||||
nbt.putInt("ProcessingTime", remainingTime);
|
nbt.putFloat("ProcessingTime", remainingTime);
|
||||||
nbt.putInt("RecipeTime", recipeDuration);
|
nbt.putFloat("RecipeTime", recipeDuration);
|
||||||
nbt.putBoolean("AppliedRecipe", appliedRecipe);
|
nbt.putBoolean("AppliedRecipe", appliedRecipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ public class ProcessingInventory extends RecipeWrapper implements IItemHandler {
|
||||||
|
|
||||||
for (int slot = 0; slot < stacks.size(); slot++)
|
for (int slot = 0; slot < stacks.size(); slot++)
|
||||||
inventory.setInventorySlotContents(slot, stacks.get(slot));
|
inventory.setInventorySlotContents(slot, stacks.get(slot));
|
||||||
inventory.remainingTime = nbt.getInt("ProcessingTime");
|
inventory.remainingTime = nbt.getFloat("ProcessingTime");
|
||||||
inventory.recipeDuration = nbt.getInt("RecipeTime");
|
inventory.recipeDuration = nbt.getFloat("RecipeTime");
|
||||||
inventory.appliedRecipe = nbt.getBoolean("AppliedRecipe");
|
inventory.appliedRecipe = nbt.getBoolean("AppliedRecipe");
|
||||||
|
|
||||||
return inventory;
|
return inventory;
|
||||||
|
|
|
@ -105,6 +105,13 @@ public class BeltTileEntity extends KineticTileEntity {
|
||||||
toRemove.forEach(passengers::remove);
|
toRemove.forEach(passengers::remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStressApplied() {
|
||||||
|
if (!isController())
|
||||||
|
return 0;
|
||||||
|
return super.getStressApplied();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
if (!isController())
|
if (!isController())
|
||||||
|
@ -205,14 +212,14 @@ public class BeltTileEntity extends KineticTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getBeltMovementSpeed() {
|
public float getBeltMovementSpeed() {
|
||||||
return getSpeed() / 1600f;
|
return getSpeed() / 480f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getDirectionAwareBeltMovementSpeed() {
|
public float getDirectionAwareBeltMovementSpeed() {
|
||||||
int offset = getBeltFacing().getAxisDirection().getOffset();
|
int offset = getBeltFacing().getAxisDirection().getOffset();
|
||||||
if (getBeltFacing().getAxis() == Axis.X)
|
if (getBeltFacing().getAxis() == Axis.X)
|
||||||
offset *= -1;
|
offset *= -1;
|
||||||
return getSpeed() / 1600f * offset;
|
return getBeltMovementSpeed() * offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPulley() {
|
public boolean hasPulley() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class BeltTileEntityRenderer extends TileEntityRenderer<BeltTileEntity> {
|
||||||
* te.getBlockState().get(HORIZONTAL_FACING).getAxisDirection().getOffset();
|
* te.getBlockState().get(HORIZONTAL_FACING).getAxisDirection().getOffset();
|
||||||
if (renderedState.get(BeltBlock.HORIZONTAL_FACING).getAxis() == Axis.X)
|
if (renderedState.get(BeltBlock.HORIZONTAL_FACING).getAxis() == Axis.X)
|
||||||
speed = -speed;
|
speed = -speed;
|
||||||
int textureIndex = (int) ((speed * time / 8) % 16);
|
int textureIndex = (int) ((speed * time / 36) % 16);
|
||||||
if (textureIndex < 0)
|
if (textureIndex < 0)
|
||||||
textureIndex += 16;
|
textureIndex += 16;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||||
float angle = (time * te.getSpeed()) % 360;
|
float angle = (time * te.getSpeed() * 3f / 10) % 360;
|
||||||
float modifier = 1;
|
float modifier = 1;
|
||||||
|
|
||||||
if (te instanceof SplitShaftTileEntity)
|
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);
|
BlockState state = defaultState.with(BlockStateProperties.FACING, direction);
|
||||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
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()) {
|
if (te.getSpeed() != 0 && te.hasSource()) {
|
||||||
BlockPos source = te.getSource().subtract(te.getPos());
|
BlockPos source = te.getSource().subtract(te.getPos());
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHan
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
float pt = mc.getRenderPartialTicks();
|
float pt = mc.getRenderPartialTicks();
|
||||||
float progress = (float) ((mc.player.getYaw(pt)) / 180 * Math.PI)
|
float progress = (float) ((mc.player.getYaw(pt)) / 180 * Math.PI)
|
||||||
+ (AnimationTickHolder.getRenderTick() * 1f);
|
+ (AnimationTickHolder.getRenderTick() / 10f);
|
||||||
if (layer == 0)
|
if (layer == 0)
|
||||||
return ColorHelper.mixColors(0x6e5773, 0x6B3074, ((float) MathHelper.sin(progress) + 1) / 2);
|
return ColorHelper.mixColors(0x6e5773, 0x6B3074, ((float) MathHelper.sin(progress) + 1) / 2);
|
||||||
if (layer == 1)
|
if (layer == 1)
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class BlockzapperItemRenderer extends ItemStackTileEntityRenderer {
|
||||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||||
BlockzapperModel mainModel = (BlockzapperModel) itemRenderer.getModelWithOverrides(stack);
|
BlockzapperModel mainModel = (BlockzapperModel) itemRenderer.getModelWithOverrides(stack);
|
||||||
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
||||||
float worldTime = AnimationTickHolder.getRenderTick();
|
float worldTime = AnimationTickHolder.getRenderTick() / 20;
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class DeforesterItemRenderer extends ItemStackTileEntityRenderer {
|
||||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
||||||
GlStateManager.enableLighting();
|
GlStateManager.enableLighting();
|
||||||
|
|
||||||
float angle = worldTime * -10 % 360;
|
float angle = worldTime * -.5f % 360;
|
||||||
float xOffset = 0;
|
float xOffset = 0;
|
||||||
float zOffset = 0;
|
float zOffset = 0;
|
||||||
GlStateManager.translatef(-xOffset, 0, -zOffset);
|
GlStateManager.translatef(-xOffset, 0, -zOffset);
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class SymmetryWandItemRenderer extends ItemStackTileEntityRenderer {
|
||||||
|
|
||||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||||
SymmetryWandModel mainModel = (SymmetryWandModel) itemRenderer.getModelWithOverrides(stack);
|
SymmetryWandModel mainModel = (SymmetryWandModel) itemRenderer.getModelWithOverrides(stack);
|
||||||
float worldTime = AnimationTickHolder.getRenderTick();
|
float worldTime = AnimationTickHolder.getRenderTick() / 20;
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||||
|
|
|
@ -51,6 +51,17 @@ public class SandPaperItem extends Item {
|
||||||
return new ActionResult<>(ActionResultType.PASS, itemstack);
|
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);
|
RayTraceResult raytraceresult = rayTrace(worldIn, playerIn, RayTraceContext.FluidMode.NONE);
|
||||||
if (!(raytraceresult instanceof BlockRayTraceResult))
|
if (!(raytraceresult instanceof BlockRayTraceResult))
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
|
@ -266,6 +266,8 @@
|
||||||
"create.generic.unit.ticks": "Ticks",
|
"create.generic.unit.ticks": "Ticks",
|
||||||
"create.generic.unit.seconds": "Seconds",
|
"create.generic.unit.seconds": "Seconds",
|
||||||
"create.generic.unit.minutes": "Minutes",
|
"create.generic.unit.minutes": "Minutes",
|
||||||
|
"create.generic.unit.rpm": "rpm",
|
||||||
|
"create.generic.unit.stress": "sU",
|
||||||
|
|
||||||
"create.action.scroll": "Scroll",
|
"create.action.scroll": "Scroll",
|
||||||
"create.action.confirm": "Confirm",
|
"create.action.confirm": "Confirm",
|
||||||
|
@ -325,6 +327,18 @@
|
||||||
"create.logistics.firstFrequency": "Freq. #1",
|
"create.logistics.firstFrequency": "Freq. #1",
|
||||||
"create.logistics.secondFrequency": "Freq. #2",
|
"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.title": "Adjustable Crate",
|
||||||
"create.gui.flexcrate.storageSpace": "Storage Space",
|
"create.gui.flexcrate.storageSpace": "Storage Space",
|
||||||
|
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
"count": 1
|
"count": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"processingTime": 50
|
"processingTime": 250
|
||||||
}
|
}
|
|
@ -22,5 +22,5 @@
|
||||||
"chance": 0.2
|
"chance": 0.2
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"processingTime": 50
|
"processingTime": 250
|
||||||
}
|
}
|
|
@ -22,5 +22,5 @@
|
||||||
"chance": 0.05
|
"chance": 0.05
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"processingTime": 50
|
"processingTime": 150
|
||||||
}
|
}
|
Loading…
Reference in a new issue