eeeeeeeeee
@@ -15,6 +15,7 @@ import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipes;
|
||||
import com.drmangotea.tfmg.registry.*;
|
||||
import com.drmangotea.tfmg.worldgen.TFMGFeatures;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -53,7 +54,7 @@ public class TFMG {
|
||||
|
||||
REGISTRATE.registerEventListeners(modEventBus);
|
||||
|
||||
|
||||
TFMGSoundEvents.prepare();
|
||||
|
||||
TFMGBlocks.init();
|
||||
TFMGBlockEntities.init();
|
||||
@@ -78,6 +79,7 @@ public class TFMG {
|
||||
TFMGPackets.registerPackets();
|
||||
TFMGConfigs.register(ModLoadingContext.get());
|
||||
modEventBus.addListener(EventPriority.LOWEST, TFMGDatagen::gatherData);
|
||||
modEventBus.addListener(TFMGSoundEvents::register);
|
||||
modEventBus.addListener(TFMG::commonSetup);
|
||||
modEventBus.addListener(this::clientSetup);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
@@ -223,7 +223,7 @@ public class TFMGUtils {
|
||||
}
|
||||
if (!isEmpty) return true;
|
||||
|
||||
CreateLang.translate("gui.goggles.item_storage_empty").style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
|
||||
CreateLang.translate("item_attributes.shulker_level.empty").style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,8 @@ package com.drmangotea.tfmg.base.events;
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.electricity.measurement.MultimeterOverlayRenderer;
|
||||
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerClientHandler;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
|
||||
import com.simibubi.create.content.equipment.blueprint.BlueprintOverlayRenderer;
|
||||
import com.simibubi.create.content.equipment.goggles.GoggleOverlayRenderer;
|
||||
import com.simibubi.create.content.equipment.toolbox.ToolboxHandlerClient;
|
||||
import com.simibubi.create.content.redstone.link.controller.LinkedControllerClientHandler;
|
||||
import com.simibubi.create.content.trains.TrainHUD;
|
||||
import com.simibubi.create.content.trains.track.TrackPlacementOverlay;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
import net.minecraftforge.client.event.*;
|
||||
@@ -19,6 +12,7 @@ import net.minecraftforge.client.event.RenderLevelStageEvent.Stage;
|
||||
import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay;
|
||||
import net.minecraftforge.event.TickEvent.ClientTickEvent;
|
||||
import net.minecraftforge.event.TickEvent.Phase;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
@@ -41,11 +35,17 @@ public class TFMGClientEvents {
|
||||
EngineControllerClientHandler.tick();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void PlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) {
|
||||
Player player = event.getEntity();
|
||||
|
||||
if (player != null)
|
||||
player.getPersistentData().remove("IsUsingEngineController");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerGuiOverlays(RegisterGuiOverlaysEvent event) {
|
||||
TFMG.LOGGER.debug("ADOIAJDOAIWDJOIA");
|
||||
event.registerAbove(VanillaGuiOverlay.HOTBAR.id(), "multimeter_info", MultimeterOverlayRenderer.OVERLAY);
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ public class TFMGCommonEvents {
|
||||
public static void onUnloadWorld(LevelEvent.Unload event) {
|
||||
LevelAccessor world = event.getLevel();
|
||||
TFMG.NETWORK_MANAGER.onUnloadWorld(world);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -29,6 +29,10 @@ public class MachineConfig extends ConfigBase {
|
||||
public final ConfigBool fireboxExhaustRequirement = b(true, "fireboxExhaustRequirement", Comments.fireboxExhaustRequirement);
|
||||
public final ConfigInt fireboxFuelConsumption = i(100, 1, "fireboxFuelConsumption", Comments.fireboxFuelConsumption);
|
||||
|
||||
public final ConfigGroup engines = group(1, "engines", "Engines");
|
||||
public final ConfigFloat engineLoudness = f(1,0, "engineLoudness", Comments.engineLoudness);
|
||||
|
||||
|
||||
public final ConfigGroup generators = group(1, "generators", "Generators");
|
||||
public final ConfigFloat largeGeneratorModifier = f(4, 0, "largeGeneratorModifier", Comments.largeGenerator);
|
||||
public final ConfigFloat largeGeneratorMinSpeed = f(70, 0, "largeGeneratorMinSpeed", Comments.largeGeneratorMinSpeed);
|
||||
@@ -71,5 +75,6 @@ public class MachineConfig extends ConfigBase {
|
||||
static String surfaceScannerScanDepth = "Y level surface scanner scan at.";
|
||||
static String FEtoWattTickConversionRate = "How much Forge Energy is in one watt-tick.";
|
||||
static String polarizerItemChargingRate = "How much FE can polarizer charge per tick.";
|
||||
static String engineLoudness = "Changes the volume of engines.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,11 +74,11 @@ public class TFMGEncasedCogVisual extends KineticBlockEntityVisual<KineticBlockE
|
||||
instance.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(rotationAxis(), pos));
|
||||
}
|
||||
|
||||
//if (d.getAxisDirection() == Direction.AxisDirection.POSITIVE) {
|
||||
// rotatingTopShaft = instance;
|
||||
//} else {
|
||||
// rotatingBottomShaft = instance;
|
||||
//}
|
||||
if (d.getAxisDirection() == Direction.AxisDirection.POSITIVE) {
|
||||
rotatingTopShaft = instance;
|
||||
} else {
|
||||
rotatingBottomShaft = instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,10 @@ public class TFMGEncasedCogVisual extends KineticBlockEntityVisual<KineticBlockE
|
||||
|
||||
@Override
|
||||
public void updateLight(float partialTick) {
|
||||
relight(rotatingModel, rotatingTopShaft, rotatingBottomShaft);
|
||||
relight(rotatingModel);
|
||||
|
||||
if (rotatingTopShaft != null) relight(rotatingTopShaft);
|
||||
if (rotatingBottomShaft != null) relight(rotatingBottomShaft);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,15 +59,13 @@ public class ElectricBlockEntity extends SmartBlockEntity implements IElectric,
|
||||
@Override
|
||||
public void lazyTick() {
|
||||
super.lazyTick();
|
||||
// updateNetwork();
|
||||
//if (data.failTimer >= 4) {
|
||||
// this.blockFail();
|
||||
// data.failTimer = 0;
|
||||
// sendStuff();
|
||||
//} else if ((data.voltage > getMaxVoltage() && getMaxVoltage() > 0) || (getCurrent() > getMaxCurrent())) {
|
||||
// blockFail();
|
||||
// data.failTimer++;
|
||||
//}
|
||||
if (data.failTimer >= 4) {
|
||||
this.blockFail();
|
||||
data.failTimer = 0;
|
||||
sendStuff();
|
||||
} else if ((data.voltage > getMaxVoltage() && getMaxVoltage() > 0) || (getCurrent() > getMaxCurrent()&&getMaxCurrent()>0)) {
|
||||
data.failTimer++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,6 +35,9 @@ public class ElectricalNetwork {
|
||||
}
|
||||
|
||||
public void updateNetwork() {
|
||||
|
||||
|
||||
|
||||
int maxVoltage = 0;
|
||||
int power = 0;
|
||||
int frequency = 0;
|
||||
|
||||
@@ -221,7 +221,8 @@ public interface IElectric {
|
||||
}
|
||||
|
||||
default void blockFail() {
|
||||
//getLevelAccessor().destroyBlock(BlockPos.of(getPos()), false);
|
||||
|
||||
getLevelAccessor().destroyBlock(BlockPos.of(getPos()), false);
|
||||
}
|
||||
|
||||
default int getPowerUsage() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drmangotea.tfmg.content.electricity.base;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.engines.types.regular_engine.RegularEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveHoveringInformation;
|
||||
@@ -100,6 +101,8 @@ public class KineticElectricBlockEntity extends GeneratingKineticBlockEntity imp
|
||||
return voltageGeneration;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int powerGeneration() {
|
||||
|
||||
@@ -206,20 +209,7 @@ public class KineticElectricBlockEntity extends GeneratingKineticBlockEntity imp
|
||||
.remove(getData().getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if(data.connectNextTick) {
|
||||
onPlaced();
|
||||
data.connectNextTick = false;
|
||||
}
|
||||
if(data.updateNextTick) {
|
||||
updateNetwork();
|
||||
data.updateNextTick = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lazyTick() {
|
||||
@@ -229,8 +219,8 @@ public class KineticElectricBlockEntity extends GeneratingKineticBlockEntity imp
|
||||
this.blockFail();
|
||||
data.failTimer = 0;
|
||||
sendStuff();
|
||||
} else if((data.voltage>getMaxVoltage()&&getMaxVoltage()>0)||(getCurrent()>getMaxCurrent()&&getMaxCurrent()>0)){
|
||||
blockFail();
|
||||
}
|
||||
if((data.voltage>getMaxVoltage()&&getMaxVoltage()>0)||(getCurrent()>getMaxCurrent()&&getMaxCurrent()>0)){
|
||||
data.failTimer++;
|
||||
}
|
||||
}
|
||||
@@ -260,7 +250,9 @@ public class KineticElectricBlockEntity extends GeneratingKineticBlockEntity imp
|
||||
@Override
|
||||
public void onSpeedChanged(float previousSpeed) {
|
||||
super.onSpeedChanged(previousSpeed);
|
||||
TFMG.LOGGER.debug("SPEEED CHANGED "+getBlockPos().getX()+" "+getBlockPos().getY()+" "+getBlockPos().getZ());
|
||||
|
||||
if(this instanceof RegularEngineBlockEntity)
|
||||
// TFMG.LOGGER.debug("SPEEED CHANGED "+getBlockPos().getX()+" "+getBlockPos().getY()+" "+getBlockPos().getZ());
|
||||
notifyNetworkAboutSpeedChange();
|
||||
timer = 0;
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ public class CableConnectorBlockEntity extends ElectricBlockEntity implements IH
|
||||
|
||||
@Override
|
||||
public AABB getRenderBoundingBox() {
|
||||
return new AABB(getBlockPos()).inflate(30);
|
||||
return new AABB(getBlockPos()).inflate(10);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.drmangotea.tfmg.registry.TFMGTags;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -28,6 +29,10 @@ public class CableConnectorRenderer extends SafeBlockEntityRenderer<CableConnect
|
||||
protected void renderSafe(CableConnectorBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay) {
|
||||
renderPlayerHeldCable(be, ms, bufferSource, partialTicks);
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
|
||||
|
||||
for (CableConnection connection : be.connections) {
|
||||
if (connection.visible)
|
||||
TFMGUtils.renderWire(be.getLevel(), ms, bufferSource, connection.pos2, connection.pos1, connection.getLength() / 4500, new Color(connection.type.color).getRed(), new Color(connection.type.color).getGreen(), new Color(connection.type.color).getBlue());
|
||||
|
||||
@@ -119,8 +119,8 @@ public class DebugCinderBlockItem extends Item {
|
||||
}
|
||||
|
||||
} else {
|
||||
//be.updateNextTick();
|
||||
be.getOrCreateElectricNetwork().checkForLoops(BlockPos.of(be.getPos()));
|
||||
be.updateNextTick();
|
||||
// be.getOrCreateElectricNetwork().checkForLoops(BlockPos.of(be.getPos()));
|
||||
TFMGUtils.debugMessage(level, "Power " + be.getNetworkPowerUsage());
|
||||
TFMGUtils.debugMessage(level, "Voltage " + be.getData().getVoltage());
|
||||
|
||||
@@ -165,12 +165,18 @@ public class DebugCinderBlockItem extends Item {
|
||||
//be.getControllerBE().rpm = 0;
|
||||
//be.getControllerBE().engineController = null;
|
||||
//be.getControllerBE().updateGeneratedRotation();
|
||||
be.updateGeneratedRotation();
|
||||
TFMGUtils.debugMessage(level, "RPM "+be.getControllerBE().shift);
|
||||
TFMGUtils.debugMessage(level, "RPM "+be.getControllerBE().rpm);
|
||||
TFMGUtils.debugMessage(level, "SIGNAL "+be.getControllerBE().signal);
|
||||
TFMGUtils.debugMessage(level, "HSIGNAL "+be.getControllerBE().highestSignal);
|
||||
TFMGUtils.debugMessage(level, "RATE "+be.getControllerBE().fuelInjectionRate);
|
||||
|
||||
be.setSpeed(0);
|
||||
|
||||
TFMGUtils.debugMessage(level, "SPEED "+be.getGeneratedSpeed());
|
||||
TFMGUtils.debugMessage(level, "SPEED "+be.getControllerBE().getGeneratedSpeed());
|
||||
|
||||
//TFMGUtils.debugMessage(level, "RPM "+be.rpm);
|
||||
//TFMGUtils.debugMessage(level, "RPM "+be.getControllerBE().rpm);
|
||||
//TFMGUtils.debugMessage(level, "SIGNAL "+be.getControllerBE().signal);
|
||||
//TFMGUtils.debugMessage(level, "HSIGNAL "+be.getControllerBE().highestSignal);
|
||||
//TFMGUtils.debugMessage(level, "RATE "+be.getControllerBE().fuelInjectionRate);
|
||||
//TFMGUtils.debugMessage(level, "RATE "+be.fuelInjectionRate);
|
||||
}
|
||||
if (level.getBlockEntity(pos) instanceof CastingBasinBlockEntity be) {
|
||||
be.findRecipe();
|
||||
|
||||
@@ -25,6 +25,15 @@ public class GeneratorBlockEntity extends KineticElectricBlockEntity {
|
||||
return generation()*40;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if(data.updateNextTick){
|
||||
updateNetwork();
|
||||
data.updateNextTick = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNetwork() {
|
||||
super.updateNetwork();
|
||||
@@ -41,8 +50,11 @@ public class GeneratorBlockEntity extends KineticElectricBlockEntity {
|
||||
return (int)(Math.min(super.calculateStressApplied()+(getGeneratorLoad() * 0.01f), 1000));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onSpeedChanged(float previousSpeed) {
|
||||
super.onSpeedChanged(previousSpeed);
|
||||
updateNextTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkChanged(int oldVoltage, int oldPower) {
|
||||
@@ -61,7 +73,8 @@ public class GeneratorBlockEntity extends KineticElectricBlockEntity {
|
||||
public int generation() {
|
||||
float modifier = TFMGConfigs.common().machines.generatorModifier.getF();
|
||||
float maxSpeed = TFMGConfigs.common().machines.generatorMinSpeed.getF();
|
||||
|
||||
if(!level.isClientSide)
|
||||
TFMG.LOGGER.debug("GENERATION: "+(int) Math.max(0,((Math.abs(getSpeed())-maxSpeed)* modifier)));
|
||||
return (int) Math.max(0,((Math.abs(getSpeed())-maxSpeed)* modifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ public class RotorBlockEntity extends KineticElectricBlockEntity {
|
||||
|
||||
LerpedFloat visualSpeed = LerpedFloat.linear();
|
||||
float angle;
|
||||
boolean findNextTick = false;
|
||||
|
||||
|
||||
List<BlockPos> stators = new ArrayList<>();
|
||||
@@ -52,6 +53,10 @@ public class RotorBlockEntity extends KineticElectricBlockEntity {
|
||||
public void tick() {
|
||||
super.tick();
|
||||
manageRotation();
|
||||
if(findNextTick){
|
||||
findStators();
|
||||
findNextTick = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,27 +3,63 @@ package com.drmangotea.tfmg.content.electricity.generators.large_generator;
|
||||
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
|
||||
public class StatorBlockEntity extends ElectricBlockEntity implements IHaveGoggleInformation {
|
||||
|
||||
public BlockPos rotor=null;
|
||||
public BlockPos rotor = null;
|
||||
|
||||
public int timer = 0;
|
||||
|
||||
public StatorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
public void setRotor(RotorBlockEntity be){
|
||||
|
||||
public void setRotor(RotorBlockEntity be) {
|
||||
rotor = be.getBlockPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lazyTick() {
|
||||
super.lazyTick();
|
||||
if(rotor!=null)
|
||||
if(!(level.getBlockEntity(rotor) instanceof RotorBlockEntity))
|
||||
if (rotor != null)
|
||||
if (!(level.getBlockEntity(rotor) instanceof RotorBlockEntity))
|
||||
rotor = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if(timer>0){
|
||||
if(timer == 1)
|
||||
updateNextTick();
|
||||
|
||||
timer--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaced() {
|
||||
super.onPlaced();
|
||||
if (rotor != null)
|
||||
if (level.getBlockEntity(rotor) instanceof RotorBlockEntity be) {
|
||||
timer =11;
|
||||
be.findNextTick = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
if (rotor != null)
|
||||
if (level.getBlockEntity(rotor) instanceof RotorBlockEntity be) {
|
||||
be.updateNextTick();
|
||||
be.findNextTick = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,16 @@ public class LightBulbBlockEntity extends ElectricBlockEntity {
|
||||
notifyUpdate();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int getMaxVoltage() {
|
||||
// return 500;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getMaxAmps() {
|
||||
// return 5;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void blockFail() {
|
||||
super.blockFail();
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.drmangotea.tfmg.content.electricity.measurement;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
@@ -29,7 +28,7 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
|
||||
public float value = 0;
|
||||
|
||||
// public int range = 500;
|
||||
// public int range = 500;
|
||||
|
||||
public MeasureMode mode = MeasureMode.VOLTAGE;
|
||||
|
||||
@@ -51,20 +50,21 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
// return;
|
||||
BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(getBlockState().getValue(FACING).getOpposite()));
|
||||
|
||||
if(beBehind instanceof IElectric be){
|
||||
// TFMG.LOGGER.debug("A "+ ElectricalNetwork.getCableCurrent(be));
|
||||
// TFMG.LOGGER.debug("id group "+be.getData().group.id);
|
||||
// TFMG.LOGGER.debug("resistance group "+be.getData().group.resistance);
|
||||
value = Math.min(getUnit(be), mode.defaultRange );
|
||||
if (beBehind instanceof IElectric be) {
|
||||
// TFMG.LOGGER.debug("A "+ ElectricalNetwork.getCableCurrent(be));
|
||||
// TFMG.LOGGER.debug("id group "+be.getData().group.id);
|
||||
// TFMG.LOGGER.debug("resistance group "+be.getData().group.resistance);
|
||||
value = Math.min(getUnit(be), mode.defaultRange);
|
||||
|
||||
} else value = 0;
|
||||
|
||||
}
|
||||
public float getUnit(IElectric be){
|
||||
return switch (mode){
|
||||
case VOLTAGE,HIGH_VOLTAGE -> be.getData().getVoltage();
|
||||
|
||||
public float getUnit(IElectric be) {
|
||||
return switch (mode) {
|
||||
case VOLTAGE, HIGH_VOLTAGE -> be.getData().getVoltage();
|
||||
case CURRENT -> be.getCurrent();
|
||||
case RESISTANCE,HIGH_RESISTANCE -> be.resistance();
|
||||
case RESISTANCE -> be.resistance();
|
||||
case POWER -> be.powerGeneration() > 0 ? be.powerGeneration() : be.getPowerUsage();
|
||||
};
|
||||
}
|
||||
@@ -72,22 +72,24 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if(!level.isClientSide)
|
||||
if (!level.isClientSide)
|
||||
return;
|
||||
|
||||
float value = (float) Math.abs(this.value) / getRange();
|
||||
if(value>1)
|
||||
if (value > 1)
|
||||
value = 1;
|
||||
|
||||
float targetAngle = Math.abs(value*180);
|
||||
float targetAngle = Math.abs(value * 180);
|
||||
|
||||
angle.chase(Math.abs(targetAngle),0.05f, LerpedFloat.Chaser.EXP);
|
||||
// TFMG.LOGGER.debug(String.valueOf(value));
|
||||
|
||||
angle.chase(Math.min(Math.abs(targetAngle),180), 0.05f, LerpedFloat.Chaser.EXP);
|
||||
angle.tickChaser();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getRange(){
|
||||
public int getRange() {
|
||||
return mode.defaultRange;
|
||||
}
|
||||
|
||||
@@ -99,8 +101,8 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
CreateLang.translate("goggles.gauge.value")
|
||||
.add(CreateLang.text(TFMGUtils.formatUnits(value,mode.unit)))
|
||||
|
||||
CreateLang.text(TFMGUtils.formatUnits(value, mode.unit))
|
||||
.style(ChatFormatting.AQUA)
|
||||
.forGoggles(tooltip, 1);
|
||||
CreateLang.translate("goggles.voltmeter.range", mode.defaultRange)
|
||||
@@ -110,14 +112,14 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
return true;
|
||||
}
|
||||
|
||||
public enum MeasureMode{
|
||||
public enum MeasureMode {
|
||||
|
||||
VOLTAGE("Voltage","V",500),
|
||||
HIGH_VOLTAGE("Voltage (High)","V",10000),
|
||||
CURRENT("Current","A",16),
|
||||
RESISTANCE("Resistance","A",500),
|
||||
HIGH_RESISTANCE("Resistance (High)","Ω",500),
|
||||
POWER("Power","A",5000),
|
||||
VOLTAGE("Voltage", "V", 500),
|
||||
HIGH_VOLTAGE("Voltage (High)", "V", 10000),
|
||||
CURRENT("Current", "A", 16),
|
||||
RESISTANCE("Resistance", "Ω", 500),
|
||||
// HIGH_RESISTANCE("Resistance (High)", "Ω", 500),
|
||||
POWER("Power", "A", 5000),
|
||||
|
||||
|
||||
;
|
||||
@@ -125,7 +127,7 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
public final String unit;
|
||||
public final int defaultRange;
|
||||
|
||||
MeasureMode(String displayName, String unit, int defaultRange){
|
||||
MeasureMode(String displayName, String unit, int defaultRange) {
|
||||
this.unit = unit;
|
||||
this.displayName = displayName;
|
||||
this.defaultRange = defaultRange;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drmangotea.tfmg.content.electricity.measurement;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
@@ -41,7 +42,7 @@ public class VoltMeterRenderer extends SafeBlockEntityRenderer<VoltMeterBlockEnt
|
||||
|
||||
if(direction.getAxis() == Direction.Axis.X)
|
||||
direction = direction.getOpposite();
|
||||
|
||||
// TFMG.LOGGER.debug(String.valueOf(be.angle.getValue(partialTicks)));
|
||||
dial
|
||||
.rotateYDegrees(direction.toYRot())
|
||||
.uncenter()
|
||||
|
||||
@@ -42,6 +42,8 @@ public class ConverterBlockEntity extends ElectricBlockEntity {
|
||||
private LazyOptional<IEnergyStorage> energyCapability = LazyOptional.empty();
|
||||
|
||||
|
||||
public int timer = 0;
|
||||
|
||||
protected ScrollValueBehaviour voltageGenerated;
|
||||
|
||||
public ConverterBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
@@ -117,7 +119,8 @@ public class ConverterBlockEntity extends ElectricBlockEntity {
|
||||
}
|
||||
|
||||
public boolean canPower() {
|
||||
|
||||
if(timer!=0)
|
||||
return false;
|
||||
|
||||
if (getBlockState().getValue(INPUT))
|
||||
return false;
|
||||
@@ -148,6 +151,14 @@ public class ConverterBlockEntity extends ElectricBlockEntity {
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if(timer>0){
|
||||
|
||||
if(timer == 1)
|
||||
updateNextTick();
|
||||
|
||||
timer--;
|
||||
}
|
||||
|
||||
|
||||
if (getBlockState().getValue(INPUT)) {
|
||||
if (getData().getVoltage() > TFMGConfigs.common().machines.accumulatorVoltage.get()) {
|
||||
@@ -159,12 +170,35 @@ public class ConverterBlockEntity extends ElectricBlockEntity {
|
||||
int energyToExtract = data.networkPowerGeneration == 0 ? getNetworkPowerUsage() : (int) Math.max(0, Math.max(((float) powerGeneration() / (float) data.networkPowerGeneration) * (float) getNetworkPowerUsage(), 0));
|
||||
energyToExtract /= TFMGConfigs.common().machines.FEtoWattTickConversionRate.get();
|
||||
energy.extractEnergy(Math.max(energyToExtract, 1), false);
|
||||
if (energy.getEnergyStored() == 0)
|
||||
if (energy.getEnergyStored() == 0) {
|
||||
timer = 100;
|
||||
updateNextTick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean makeMultimeterTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
super.makeMultimeterTooltip(tooltip, isPlayerSneaking);
|
||||
|
||||
|
||||
CreateLang.text("Capacity ")
|
||||
.add(Component.literal(TFMGUtils.formatUnits(energy.getEnergyStored(), "FE")))
|
||||
.color(0x127799)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
CreateLang.text("Charging Rate ")
|
||||
.add(CreateLang.number(getChargingRate()))
|
||||
.color(0x127799)
|
||||
.forGoggles(tooltip, 1);
|
||||
CreateLang.text("Max Capacity ")
|
||||
.add(CreateLang.number(getMaxCapacity()))
|
||||
.color(0x127799)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getMaxCapacity() {
|
||||
return TFMGConfigs.common().machines.accumulatorStorage.get();
|
||||
|
||||
@@ -105,7 +105,7 @@ public class ElectricMotorBlockEntity extends KineticElectricBlockEntity {
|
||||
if(speed==0){
|
||||
return testSpeed;
|
||||
}
|
||||
TFMG.LOGGER.debug("SPEED: "+speed+" "+generatedSpeed.getValue()+" "+data.getVoltage()/2);
|
||||
// TFMG.LOGGER.debug("SPEED: "+speed+" "+generatedSpeed.getValue()+" "+data.getVoltage()/2);
|
||||
testSpeed = 0;
|
||||
return speed;
|
||||
|
||||
|
||||
@@ -33,35 +33,35 @@ public class FuseBlock extends TFMGHorizontalDirectionalBlock implements IBE<Fus
|
||||
@Override
|
||||
public InteractionResult use(BlockState blockState, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult blockHitResult) {
|
||||
|
||||
ItemStack inHand = player.getItemInHand(hand);
|
||||
|
||||
if(level.getBlockEntity(pos) instanceof FuseBlockEntity be){
|
||||
|
||||
if(inHand.is(TFMGItems.FUSE.get())){
|
||||
|
||||
player.setItemInHand(hand, be.fuse);
|
||||
be.fuse = inHand;
|
||||
be.updateInFrontNextTick();
|
||||
be.updateNextTick();
|
||||
be.updateNetwork();
|
||||
be.updateInFront();
|
||||
be.sendStuff();
|
||||
return InteractionResult.SUCCESS;
|
||||
|
||||
}else
|
||||
if(inHand.isEmpty()){
|
||||
player.setItemInHand(hand, be.fuse);
|
||||
be.fuse = ItemStack.EMPTY;
|
||||
be.updateNextTick();
|
||||
be.updateNetwork();
|
||||
be.updateNetwork();
|
||||
be.updateInFront();
|
||||
be.sendStuff();
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//ItemStack inHand = player.getItemInHand(hand);
|
||||
//
|
||||
//if(level.getBlockEntity(pos) instanceof FuseBlockEntity be){
|
||||
//
|
||||
// if(inHand.is(TFMGItems.FUSE.get())){
|
||||
//
|
||||
// player.setItemInHand(hand, be.fuse);
|
||||
// be.fuse = inHand;
|
||||
// be.updateInFrontNextTick();
|
||||
// be.updateNextTick();
|
||||
// be.updateNetwork();
|
||||
// be.updateInFront();
|
||||
// be.sendStuff();
|
||||
// return InteractionResult.SUCCESS;
|
||||
//
|
||||
// }else
|
||||
// if(inHand.isEmpty()){
|
||||
// player.setItemInHand(hand, be.fuse);
|
||||
// be.fuse = ItemStack.EMPTY;
|
||||
// be.updateNextTick();
|
||||
// be.updateNetwork();
|
||||
// be.updateNetwork();
|
||||
// be.updateInFront();
|
||||
// be.sendStuff();
|
||||
// return InteractionResult.SUCCESS;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
return super.use(blockState, level, pos, player, hand, blockHitResult);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public class PotentiometerBlockEntity extends ElectricDiodeBlockEntity {
|
||||
if (getSide() != Direction.UP)
|
||||
return;
|
||||
TransformStack.of(ms)
|
||||
.rotateZ(-AngleHelper.horizontalAngle(facing) + 180);
|
||||
.rotateZDegrees(-AngleHelper.horizontalAngle(facing) + 180);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,13 +52,13 @@ public class SegmentedDisplayBlockEntity extends ElectricBlockEntity {
|
||||
|
||||
@Override
|
||||
public float resistance() {
|
||||
return 5;
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lazyTick() {
|
||||
super.lazyTick();
|
||||
if(getPowerUsage()<5){
|
||||
if(getPowerUsage()<5||!canWork()){
|
||||
segmentsToRender = new ArrayList<>();
|
||||
segmentsToRender2 = new ArrayList<>();
|
||||
}else {
|
||||
|
||||
@@ -35,6 +35,9 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static com.drmangotea.tfmg.content.engines.base.EngineBlock.ENGINE_STATE;
|
||||
import static com.drmangotea.tfmg.content.engines.base.EngineBlock.EngineState.SHAFT;
|
||||
|
||||
public abstract class AbstractEngineBlockEntity extends KineticElectricBlockEntity {
|
||||
|
||||
//
|
||||
@@ -68,8 +71,8 @@ public abstract class AbstractEngineBlockEntity extends KineticElectricBlockEnti
|
||||
public AbstractEngineBlockEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
super(typeIn, pos, state);
|
||||
setLazyTickRate(10);
|
||||
fuelTank = new EngineFluidTank(4000, false, true, this::tankUpdated, TFMGTags.TFMGFluidTags.AIR.tag);
|
||||
exhaustTank = new EngineFluidTank(8000, true, false, this::tankUpdated);
|
||||
fuelTank = new EngineFluidTank(4000, false, true, f->tankUpdated(f,true), TFMGTags.TFMGFluidTags.AIR.tag);
|
||||
exhaustTank = new EngineFluidTank(8000, true, false, f->tankUpdated(f,false));
|
||||
fluidCapability = LazyOptional.of(() -> new CombinedTankWrapper(fuelTank, exhaustTank));
|
||||
|
||||
refreshCapability();
|
||||
@@ -84,8 +87,9 @@ public abstract class AbstractEngineBlockEntity extends KineticElectricBlockEnti
|
||||
super.tick();
|
||||
}
|
||||
|
||||
public void tankUpdated(FluidStack stack) {
|
||||
|
||||
public void tankUpdated(FluidStack stack, boolean fuelTank ) {
|
||||
if(fuelTank && stack.isEmpty())
|
||||
updateRotation();
|
||||
sendData();
|
||||
setChanged();
|
||||
}
|
||||
@@ -130,10 +134,6 @@ public abstract class AbstractEngineBlockEntity extends KineticElectricBlockEnti
|
||||
return super.addToGoggleTooltip(tooltip, isPlayerSneaking);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateAddedStressCapacity() {
|
||||
return super.calculateAddedStressCapacity() + (torque);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lazyTick() {
|
||||
@@ -276,7 +276,7 @@ public abstract class AbstractEngineBlockEntity extends KineticElectricBlockEnti
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
reverse = compound.getBoolean("Reverse");
|
||||
signal = compound.getInt("Signal");
|
||||
signal = compound.getInt("Signal")+1;
|
||||
if (hasEngineController())
|
||||
engineController = BlockPos.of(compound.getLong("EngineController"));
|
||||
fuelInjectionRate = compound.getFloat("RPM");
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.drmangotea.tfmg.content.engines.base;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGShapes;
|
||||
import com.drmangotea.tfmg.content.electricity.base.UpdateInFrontPacket;
|
||||
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.types.AbstractSmallEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.types.radial_engine.RadialEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.types.turbine_engine.TurbineEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.upgrades.EnginePipingUpgrade;
|
||||
import com.drmangotea.tfmg.content.engines.upgrades.TransmissionUpgrade;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.kinetics.base.HorizontalKineticBlock;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -24,14 +23,12 @@ import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -59,7 +56,7 @@ public class EngineBlock extends HorizontalKineticBlock {
|
||||
if (be.upgrade.isPresent()) {
|
||||
|
||||
if (be.upgrade.get() instanceof TransmissionUpgrade) {
|
||||
if (be.getControllerBE().engineController != null){
|
||||
if (be.getControllerBE().engineController != null) {
|
||||
if (level.getBlockEntity(be.getControllerBE().engineController) instanceof EngineControllerBlockEntity engineController) {
|
||||
engineController.engineStarted = false;
|
||||
engineController.accelerationRate = 0;
|
||||
@@ -73,10 +70,10 @@ public class EngineBlock extends HorizontalKineticBlock {
|
||||
}
|
||||
//if(!level.isClientSide)
|
||||
// TFMGPackets.getChannel().send(PacketDistributor.ALL.noArg(), new UpdateInFrontPacket(BlockPos.of(be.getPos())));
|
||||
be.getControllerBE().engineController =null;
|
||||
be.getControllerBE().engineController = null;
|
||||
be.getControllerBE().highestSignal = 0;
|
||||
be.getControllerBE().connectNextTick=true;
|
||||
be.getControllerBE().fuelInjectionRate=0;
|
||||
be.getControllerBE().connectNextTick = true;
|
||||
be.getControllerBE().fuelInjectionRate = 0;
|
||||
be.updateGeneratedRotation();
|
||||
be.getControllerBE().updateGeneratedRotation();
|
||||
be.getControllerBE().sendData();
|
||||
@@ -92,19 +89,21 @@ public class EngineBlock extends HorizontalKineticBlock {
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
if (state.getValue(ENGINE_STATE) == SHAFT) {
|
||||
be.playRemovalSound();
|
||||
be.dropItem(AllBlocks.SHAFT.asStack());
|
||||
level.setBlock(pos, state.setValue(ENGINE_STATE, NORMAL), 2);
|
||||
be.connectNextTick = true;
|
||||
be.detachKinetics();
|
||||
if (be.getOrCreateNetwork() != null)
|
||||
be.getOrCreateNetwork().remove(be);
|
||||
be.setChanged();
|
||||
be.sendData();
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
if (!(be instanceof RadialEngineBlockEntity) && !(be instanceof TurbineEngineBlockEntity))
|
||||
if (state.getValue(ENGINE_STATE) == SHAFT) {
|
||||
be.playRemovalSound();
|
||||
be.dropItem(AllBlocks.SHAFT.asStack());
|
||||
level.setBlock(pos, state.setValue(ENGINE_STATE, NORMAL), 2);
|
||||
be.connectNextTick = true;
|
||||
be.detachKinetics();
|
||||
be.getControllerBE().updateGeneratedRotation();
|
||||
be.updateGeneratedRotation();
|
||||
if (be.getOrCreateNetwork() != null)
|
||||
be.getOrCreateNetwork().remove(be);
|
||||
be.setChanged();
|
||||
be.sendData();
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
@@ -132,7 +131,7 @@ public class EngineBlock extends HorizontalKineticBlock {
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
||||
super.createBlockStateDefinition(builder);
|
||||
builder.add(ENGINE_STATE,SHAFT_FACING);
|
||||
builder.add(ENGINE_STATE, SHAFT_FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -73,6 +73,15 @@ public class EngineProperties {
|
||||
pistonPositions.add(new PistonPosition(0,f,f,315));
|
||||
return pistonPositions;
|
||||
}
|
||||
public static List<PistonPosition> pistonsTurbine() {
|
||||
|
||||
List<PistonPosition> pistonPositions = new ArrayList<>();
|
||||
pistonPositions.add(new PistonPosition(0, 0, 0, 0));
|
||||
pistonPositions.add(new PistonPosition(0, 0, 0, 0));
|
||||
pistonPositions.add(new PistonPosition(0, 0, 0, 0));
|
||||
pistonPositions.add(new PistonPosition(0, 0, 0, 0));
|
||||
return pistonPositions;
|
||||
}
|
||||
//
|
||||
|
||||
//public static List<ItemStack> componentsW(){
|
||||
|
||||
@@ -373,7 +373,7 @@ public class EngineControllerBlockEntity extends SmartBlockEntity implements IHa
|
||||
}
|
||||
|
||||
private void stopUsing(Player player) {
|
||||
TFMG.LOGGER.debug("STOP USING");
|
||||
|
||||
|
||||
user = null;
|
||||
if (player != null)
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.drmangotea.tfmg.content.engines.types;
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineBlock;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineComponentsInventory;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineProperties;
|
||||
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerBlockEntity;
|
||||
@@ -51,8 +52,8 @@ public abstract class AbstractSmallEngineBlockEntity extends AbstractEngineBlock
|
||||
public TransmissionUpgrade.TransmissionState shift = TransmissionUpgrade.TransmissionState.NEUTRAL;
|
||||
|
||||
|
||||
int oil = 0;
|
||||
int coolingFluid = 0;
|
||||
public int oil = 0;
|
||||
public int coolingFluid = 0;
|
||||
|
||||
public EngineComponentsInventory componentsInventory;
|
||||
|
||||
@@ -72,8 +73,12 @@ public abstract class AbstractSmallEngineBlockEntity extends AbstractEngineBlock
|
||||
if (rpm == 0)
|
||||
return 0;
|
||||
|
||||
float oilModifier = oil > 0 ? 0.7f : 1f;
|
||||
|
||||
return (int) (12.5f * (1 / efficiencyModifier()) * getSpeedEfficiency() * fuelInjectionRate) * (engineLength() + 1);
|
||||
float coolingFluidModifier = coolingFluid > 0 ? 0.7f : 1f;
|
||||
|
||||
|
||||
return (int) (12.5f * (1 / efficiencyModifier()) * getSpeedEfficiency() * fuelInjectionRate * oilModifier * coolingFluidModifier) * (engineLength() + 1);
|
||||
}
|
||||
|
||||
public void detashEngines() {
|
||||
@@ -132,10 +137,38 @@ public abstract class AbstractSmallEngineBlockEntity extends AbstractEngineBlock
|
||||
public void lazyTick() {
|
||||
super.lazyTick();
|
||||
|
||||
if (level.random.nextInt(45) == 0) {
|
||||
if (oil > 0)
|
||||
oil--;
|
||||
}
|
||||
if (level.random.nextInt(45) == 0) {
|
||||
if (coolingFluid > 0)
|
||||
coolingFluid--;
|
||||
}
|
||||
|
||||
upgrade.ifPresent(engineUpgrade -> engineUpgrade.lazyTickUpgrade(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateAddedStressCapacity() {
|
||||
float stress = super.calculateAddedStressCapacity() + (torque);
|
||||
return hasTwoShafts() ? stress / 2 : stress;
|
||||
}
|
||||
|
||||
public boolean hasTwoShafts() {
|
||||
|
||||
if (!isController())
|
||||
return getControllerBE().hasTwoShafts();
|
||||
|
||||
if (this.getBlockState().getValue(ENGINE_STATE) == SHAFT) {
|
||||
BlockState state = level.getBlockState(controller.south(engineLength()));
|
||||
if (state.getBlock() instanceof EngineBlock)
|
||||
if (engineLength() > 1 && state.getValue(ENGINE_STATE) == SHAFT)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighbourChanged() {
|
||||
if (controller == null)
|
||||
@@ -292,53 +325,60 @@ public abstract class AbstractSmallEngineBlockEntity extends AbstractEngineBlock
|
||||
});
|
||||
}
|
||||
|
||||
public boolean canGenerateSpeed() {
|
||||
if (getBlockState().getValue(ENGINE_STATE) != SHAFT)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getGeneratedSpeed() {
|
||||
|
||||
float speed;
|
||||
|
||||
if (getBlockState().getValue(ENGINE_STATE) != SHAFT)
|
||||
if (!canGenerateSpeed())
|
||||
return 0;
|
||||
|
||||
if (hasLevel())
|
||||
|
||||
if (level.getBlockEntity(controller) instanceof AbstractSmallEngineBlockEntity controller) {
|
||||
if (controller.fuelTank.isEmpty())
|
||||
return 0;
|
||||
if (!controller.canWork())
|
||||
return 0;
|
||||
speed = rpm / 40;
|
||||
if (reverse)
|
||||
speed = speed * -1;
|
||||
|
||||
if (controller.hasEngineController()) {
|
||||
|
||||
speed = switch (controller.shift) {
|
||||
case REVERSE -> speed * -0.3f;
|
||||
case NEUTRAL -> 0;
|
||||
case SHIFT_1 -> speed * 0.2f;
|
||||
case SHIFT_2 -> speed * 0.4f;
|
||||
case SHIFT_3 -> speed * 0.6f;
|
||||
case SHIFT_4 -> speed * 0.8f;
|
||||
case SHIFT_5 -> speed;
|
||||
case SHIFT_6 -> speed * 1.2f;
|
||||
};
|
||||
float speed;
|
||||
|
||||
|
||||
}
|
||||
if (hasLevel()) {
|
||||
if (getControllerBE().fuelTank.isEmpty())
|
||||
return 0;
|
||||
if (!getControllerBE().canWork())
|
||||
return 0;
|
||||
speed = rpm / 40;
|
||||
if (reverse)
|
||||
speed = speed * -1;
|
||||
|
||||
if (getControllerBE().hasEngineController()) {
|
||||
|
||||
speed = switch (getControllerBE().shift) {
|
||||
case REVERSE -> speed * -0.3f;
|
||||
case NEUTRAL -> 0;
|
||||
case SHIFT_1 -> speed * 0.2f;
|
||||
case SHIFT_2 -> speed * 0.4f;
|
||||
case SHIFT_3 -> speed * 0.6f;
|
||||
case SHIFT_4 -> speed * 0.8f;
|
||||
case SHIFT_5 -> speed;
|
||||
case SHIFT_6 -> speed * 1.2f;
|
||||
};
|
||||
|
||||
|
||||
return convertToDirection(Math.min((int) speed, 256), getBlockState().getValue(HORIZONTAL_FACING));
|
||||
}
|
||||
|
||||
|
||||
return convertToDirection(Math.min((int) speed, 256), getBlockState().getValue(HORIZONTAL_FACING));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tankUpdated(FluidStack stack) {
|
||||
public void tankUpdated(FluidStack stack, boolean fuel) {
|
||||
if (stack.getFluid().isSame(TFMGFluids.CARBON_DIOXIDE.get()) && stack.getAmount() >= exhaustTank.getSpace())
|
||||
updateRotation();
|
||||
super.tankUpdated(stack);
|
||||
super.tankUpdated(stack, fuel);
|
||||
}
|
||||
|
||||
public boolean insertItem(ItemStack itemStack, boolean shifting, Player player, InteractionHand hand) {
|
||||
@@ -527,6 +567,7 @@ public abstract class AbstractSmallEngineBlockEntity extends AbstractEngineBlock
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.drmangotea.tfmg.content.engines.types.large_engine;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.config.TFMGConfigs;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineFluidTank;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGSoundEvents;
|
||||
import com.drmangotea.tfmg.registry.TFMGTags;
|
||||
import com.simibubi.create.content.kinetics.base.GeneratingKineticBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
@@ -13,6 +15,7 @@ import com.simibubi.create.content.kinetics.steamEngine.PoweredShaftBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.steamEngine.SteamEngineBlock;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
||||
import net.createmod.catnip.math.AngleHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
@@ -39,7 +42,6 @@ import java.util.List;
|
||||
|
||||
public class LargeEngineBlockEntity extends AbstractEngineBlockEntity {
|
||||
|
||||
//protected ScrollOptionBehaviour<WindmillBearingBlockEntity.RotationDirection> movementDirection;
|
||||
|
||||
public WeakReference<PoweredShaftBlockEntity> target;
|
||||
|
||||
@@ -50,8 +52,8 @@ public class LargeEngineBlockEntity extends AbstractEngineBlockEntity {
|
||||
public LargeEngineBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
target = new WeakReference<>(null);
|
||||
fuelTank = new EngineFluidTank(2000, false, true, this::tankUpdated, TFMGTags.TFMGFluidTags.AIR.tag);
|
||||
airTank = new EngineFluidTank(1000, false, true, TFMGTags.TFMGFluidTags.AIR.tag, this::tankUpdated);
|
||||
fuelTank = new EngineFluidTank(2000, false, true, f->tankUpdated(f,true), TFMGTags.TFMGFluidTags.AIR.tag);
|
||||
airTank = new EngineFluidTank(1000, false, true, TFMGTags.TFMGFluidTags.AIR.tag, f->tankUpdated(f,true));
|
||||
refreshCapability();
|
||||
}
|
||||
|
||||
@@ -93,26 +95,31 @@ public class LargeEngineBlockEntity extends AbstractEngineBlockEntity {
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
|
||||
if (shaft == null) {
|
||||
if (level.isClientSide())
|
||||
if (!level.isClientSide()) {
|
||||
|
||||
if (shaft == null)
|
||||
return;
|
||||
if (!shaft.getBlockPos()
|
||||
.subtract(worldPosition)
|
||||
.equals(shaft.enginePos))
|
||||
return;
|
||||
if (shaft.engineEfficiency == 0)
|
||||
return;
|
||||
Direction facing = LargeEngineBlock.getFacing(getBlockState());
|
||||
if (level.isLoaded(worldPosition.relative(facing.getOpposite())))
|
||||
shaft.update(worldPosition, 0, 0);
|
||||
return;
|
||||
if (shaft == null)
|
||||
return;
|
||||
if (!shaft.getBlockPos()
|
||||
.subtract(worldPosition)
|
||||
.equals(shaft.enginePos))
|
||||
return;
|
||||
if (shaft.engineEfficiency == 0)
|
||||
return;
|
||||
Direction facing = LargeEngineBlock.getFacing(getBlockState());
|
||||
if (level.isLoaded(worldPosition.relative(facing.getOpposite())))
|
||||
shaft.update(worldPosition, 0, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BlockState blockState = getBlockState();
|
||||
if (!TFMGBlocks.LARGE_ENGINE.has(blockState) && !TFMGBlocks.SIMPLE_LARGE_ENGINE.has(blockState))
|
||||
return;
|
||||
|
||||
if(level.isClientSide)
|
||||
makeSound();
|
||||
|
||||
|
||||
if (!level.isClientSide)
|
||||
if (getShaft() != null)
|
||||
engineProcess();
|
||||
@@ -140,66 +147,46 @@ public class LargeEngineBlockEntity extends AbstractEngineBlockEntity {
|
||||
}
|
||||
|
||||
|
||||
/// /@OnlyIn(Dist.CLIENT)
|
||||
//private void makeSound(Axis targetAxis, boolean verticalTarget) {
|
||||
// Float targetAngle = getTargetAngle();
|
||||
// PoweredShaftBlockEntity ste = target.get();
|
||||
// if (ste == null)
|
||||
// return;
|
||||
// //if (engineStrength == 0)
|
||||
// // return;
|
||||
// PoweredShaftBlockEntity shaft = getShaft();
|
||||
//
|
||||
// if (tanks.get(true).isEmpty() || tanks.get(true).isEmpty()) {
|
||||
// engineStrength = 0;
|
||||
//
|
||||
// shaft.update(worldPosition, getConveyedSpeedLevel(engineStrength, targetAxis, verticalTarget), engineStrength);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (expansionBE != null) {
|
||||
// if (airTank.isEmpty() && expansionBE.airTank.isEmpty()) {
|
||||
// engineStrength = 0;
|
||||
// shaft.update(worldPosition, getConveyedSpeedLevel(engineStrength, targetAxis, verticalTarget), engineStrength);
|
||||
// return;
|
||||
// }
|
||||
// } else if (airTank.isEmpty()) {
|
||||
// engineStrength = 0;
|
||||
// shaft.update(worldPosition, getConveyedSpeedLevel(engineStrength, targetAxis, verticalTarget), engineStrength);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (tanks.get(false).getFluidAmount() + 5 > 1000) {
|
||||
// engineStrength = 0;
|
||||
// shaft.update(worldPosition, getConveyedSpeedLevel(engineStrength, targetAxis, verticalTarget), engineStrength);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (targetAngle == null)
|
||||
// return;
|
||||
//
|
||||
// float angle = AngleHelper.deg(targetAngle);
|
||||
// angle += (angle < 0) ? -180 + 75 : 360 - 75;
|
||||
// angle %= 360;
|
||||
//
|
||||
//
|
||||
// if (shaft == null || shaft.getSpeed() == 0)
|
||||
// return;
|
||||
//
|
||||
// if (angle >= 0 && !(prevAngle > 180 && angle < 180)) {
|
||||
// prevAngle = angle;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (angle < 0 && !(prevAngle < -180 && angle > -180)) {
|
||||
// prevAngle = angle;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// TFMGSoundEvents.DIESEL_ENGINE.playAt(level, worldPosition, 0.4f, 1f, false);
|
||||
//
|
||||
// prevAngle = angle;
|
||||
//}
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private void makeSound() {
|
||||
Float targetAngle = getTargetAngle();
|
||||
PoweredShaftBlockEntity ste = target.get();
|
||||
if (ste == null)
|
||||
return;
|
||||
if(getShaft().getSpeed()==0)
|
||||
return;
|
||||
if(fuelTank.isEmpty()||airTank.isEmpty()||exhaustTank.getSpace() == 0)
|
||||
return;
|
||||
//if (engineStrength == 0)
|
||||
// return;
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
|
||||
|
||||
if (targetAngle == null)
|
||||
return;
|
||||
|
||||
float angle = AngleHelper.deg(targetAngle);
|
||||
angle += (angle < 0) ? -180 + 75 : 360 - 75;
|
||||
angle %= 360;
|
||||
|
||||
|
||||
if (shaft == null || shaft.getSpeed() == 0)
|
||||
return;
|
||||
|
||||
if (angle >= 0 && !(prevAngle > 180 && angle < 180)) {
|
||||
prevAngle = angle;
|
||||
return;
|
||||
}
|
||||
|
||||
if (angle < 0 && !(prevAngle < -180 && angle > -180)) {
|
||||
prevAngle = angle;
|
||||
return;
|
||||
}
|
||||
|
||||
TFMGSoundEvents.DIESEL_ENGINE.playAt(level, worldPosition, 0.4f * TFMGConfigs.common().machines.engineLoudness.getF(), 1f, false);
|
||||
|
||||
prevAngle = angle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWork() {
|
||||
@@ -230,6 +217,9 @@ public class LargeEngineBlockEntity extends AbstractEngineBlockEntity {
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
if(getShaft() == null)
|
||||
return false;
|
||||
|
||||
TFMGUtils.createFluidTooltip(this,tooltip);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -21,24 +21,33 @@ public class RadialEngineBlockEntity extends RegularEngineBlockEntity {
|
||||
|
||||
}
|
||||
@Override
|
||||
public float getGeneratedSpeed() {
|
||||
public boolean canGenerateSpeed() {
|
||||
return true;
|
||||
}
|
||||
//@Override
|
||||
//public float getGeneratedSpeed() {
|
||||
//
|
||||
// float speed;
|
||||
//
|
||||
// if (hasLevel())
|
||||
//
|
||||
// if (level.getBlockEntity(controller) instanceof AbstractEngineBlockEntity controller) {
|
||||
// if (controller.fuelTank.isEmpty())
|
||||
// return 0;
|
||||
// if (!controller.canWork())
|
||||
// return 0;
|
||||
// speed = rpm / 40;
|
||||
// if (reverse)
|
||||
// speed = speed * -1;
|
||||
//
|
||||
// return convertToDirection(Math.min((int) speed, 256), getBlockState().getValue(HORIZONTAL_FACING));
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
float speed;
|
||||
|
||||
if (hasLevel())
|
||||
|
||||
if (level.getBlockEntity(controller) instanceof AbstractEngineBlockEntity controller) {
|
||||
if (controller.fuelTank.isEmpty())
|
||||
return 0;
|
||||
if (!controller.canWork())
|
||||
return 0;
|
||||
speed = rpm / 40;
|
||||
if (reverse)
|
||||
speed = speed * -1;
|
||||
|
||||
return convertToDirection(Math.min((int) speed, 256), getBlockState().getValue(HORIZONTAL_FACING));
|
||||
}
|
||||
return 0;
|
||||
@Override
|
||||
public boolean hasTwoShafts() {
|
||||
return engineLength()>1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.drmangotea.tfmg.content.engines.types.regular_engine;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.config.TFMGConfigs;
|
||||
import com.drmangotea.tfmg.content.engines.types.AbstractSmallEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.types.turbine_engine.TurbineEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.drmangotea.tfmg.registry.TFMGSoundEvents;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.foundation.item.SmartInventory;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -18,9 +21,12 @@ import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -40,6 +46,8 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
|
||||
List<TagKey<Fluid>> supportedFuels = new ArrayList<>();
|
||||
|
||||
protected int soundTimer=0;
|
||||
|
||||
boolean updateFuel = true;
|
||||
|
||||
public RegularEngineBlockEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
@@ -48,7 +56,7 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
|
||||
}
|
||||
|
||||
public EngineType getDefaultEngineType(){
|
||||
public EngineType getDefaultEngineType() {
|
||||
return EngineType.I;
|
||||
}
|
||||
|
||||
@@ -123,6 +131,20 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasAllPistons(){
|
||||
for (Long position : getControllerBE().getAllEngines()) {
|
||||
|
||||
if (level.getBlockEntity(BlockPos.of(position)) instanceof RegularEngineBlockEntity be) {
|
||||
for (int i = 0; i < be.pistonInventory.getSlots(); i++) {
|
||||
if (be.pistonInventory.getItem(i).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertItem(ItemStack itemStack, boolean shifting, Player player, InteractionHand hand) {
|
||||
|
||||
@@ -177,21 +199,22 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
|
||||
}
|
||||
if (hasAllComponents())
|
||||
if (itemStack.is(TFMGItems.ENGINE_CYLINDER.get()) && isCylinderSame(itemStack)) {
|
||||
for (int i = pistonInventory.getSlots() - 1; i >= 0; i--) {
|
||||
if (pistonInventory.getItem(i).isEmpty()) {
|
||||
ItemStack toInsert = itemStack.copy();
|
||||
toInsert.setCount(1);
|
||||
pistonInventory.setItem(i, toInsert);
|
||||
itemStack.shrink(1);
|
||||
playInsertionSound();
|
||||
updateRotation();
|
||||
setChanged();
|
||||
sendData();
|
||||
return true;
|
||||
if (isCorrectCylinder(itemStack))
|
||||
if (isCylinderSame(itemStack)) {
|
||||
for (int i = pistonInventory.getSlots() - 1; i >= 0; i--) {
|
||||
if (pistonInventory.getItem(i).isEmpty()) {
|
||||
ItemStack toInsert = itemStack.copy();
|
||||
toInsert.setCount(1);
|
||||
pistonInventory.setItem(i, toInsert);
|
||||
itemStack.shrink(1);
|
||||
playInsertionSound();
|
||||
updateRotation();
|
||||
setChanged();
|
||||
sendData();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nextComponent().test(itemStack) && !isController()) {
|
||||
|
||||
if (level.getBlockEntity(controller) instanceof AbstractSmallEngineBlockEntity be) {
|
||||
@@ -203,8 +226,15 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
return super.insertItem(itemStack, shifting, player, hand);
|
||||
}
|
||||
|
||||
public boolean isCorrectCylinder(ItemStack itemStack) {
|
||||
return itemStack.is(TFMGItems.ENGINE_CYLINDER.get())||itemStack.is(TFMGItems.SIMPLE_ENGINE_CYLINDER.get())||itemStack.is(TFMGItems.DIESEL_ENGINE_CYLINDER.get());
|
||||
}
|
||||
|
||||
public boolean isCylinderSame(ItemStack stack) {
|
||||
|
||||
if(stack.is(TFMGItems.TURBINE_BLADE.get()))
|
||||
return true;
|
||||
|
||||
CompoundTag tag = stack.getOrCreateTag().getCompound("Fuels");
|
||||
|
||||
|
||||
@@ -237,6 +267,10 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
if (level.isClientSide)
|
||||
makeSound();
|
||||
|
||||
|
||||
if (updateFuel) {
|
||||
refreshFuels();
|
||||
updateFuel = false;
|
||||
@@ -244,6 +278,27 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private void makeSound(){
|
||||
soundTimer++;
|
||||
|
||||
|
||||
if(soundTimer>1/Math.min(6000,(rpm*0.0002)*pistonInventory.getSlots())) {
|
||||
|
||||
|
||||
soundTimer = 0;
|
||||
|
||||
float randomPitch = (level.getRandom().nextFloat()-.5f)*0.05f;
|
||||
|
||||
if (this instanceof TurbineEngineBlockEntity) {
|
||||
TFMGSoundEvents.ENGINE.playAt(level, worldPosition, 0.06f * TFMGConfigs.common().machines.engineLoudness.getF(), 1.5f, false);
|
||||
} else
|
||||
|
||||
TFMGSoundEvents.ENGINE.playAt(level, worldPosition, 0.1f * TFMGConfigs.common().machines.engineLoudness.getF(), 0.7f+ randomPitch, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean updateEngineType(EngineType newType) {
|
||||
|
||||
Direction updateDirection = getBlockState().getValue(HORIZONTAL_FACING);
|
||||
@@ -308,15 +363,69 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
for (TagKey<Fluid> tag : supportedFuels) {
|
||||
if(!isController())
|
||||
return getControllerBE().addToGoggleTooltip(tooltip,isPlayerSneaking);
|
||||
|
||||
CreateLang.text(tag.toString()).forGoggles(tooltip);
|
||||
|
||||
|
||||
CreateLang.translate("goggles.engine.header")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
if(nextComponent()!= Ingredient.EMPTY){
|
||||
CreateLang.translate("goggles.engine.unfinished")
|
||||
.color(0xde5050)
|
||||
.forGoggles(tooltip);
|
||||
CreateLang.translate("goggles.engine.next_component")
|
||||
.add(Component.empty().append(nextComponent().getItems()[0].getHoverName()))
|
||||
.color(0xfff240)
|
||||
.forGoggles(tooltip);
|
||||
return true;
|
||||
}
|
||||
if(!hasAllPistons()){
|
||||
|
||||
CreateLang.translate(this instanceof TurbineEngineBlockEntity ? "goggles.engine.turbines_missing" : "goggles.engine.pistons_missing")
|
||||
.color(0xde5050)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CreateLang.text("Type: " + type.name).forGoggles(tooltip);
|
||||
|
||||
super.addToGoggleTooltip(tooltip, isPlayerSneaking);
|
||||
CreateLang.translate("goggles.engine.type")
|
||||
.add(CreateLang.text(type.name()))
|
||||
.color(0xfcad03)
|
||||
.forGoggles(tooltip);
|
||||
CreateLang.translate("goggles.engine.rpm")
|
||||
.add(CreateLang.text((int)rpm+" rpm"))
|
||||
.color(0xa36f00)
|
||||
.forGoggles(tooltip);
|
||||
CreateLang.translate("goggles.engine.signal")
|
||||
.add(CreateLang.text(String.valueOf(highestSignal)))
|
||||
.color(0xfcad03)
|
||||
.forGoggles(tooltip);
|
||||
CreateLang.translate("goggles.engine.torque")
|
||||
.add(CreateLang.text(String.valueOf((int)torque)))
|
||||
.color(0xa36f00)
|
||||
.forGoggles(tooltip);
|
||||
CreateLang.translate("goggles.engine.fuel_consumption")
|
||||
.add(CreateLang.text(getFuelConsumption()/1.5f+" mb/s"))
|
||||
.color(0xfcad03)
|
||||
.forGoggles(tooltip);
|
||||
if(oil>0){
|
||||
CreateLang.translate("goggles.engine.oil")
|
||||
.add(CreateLang.number(oil))
|
||||
.color(0xf5dd42)
|
||||
.forGoggles(tooltip);
|
||||
}
|
||||
if(coolingFluid>0){
|
||||
CreateLang.translate("goggles.engine.cooling_fluid")
|
||||
.add(CreateLang.number(coolingFluid))
|
||||
.color(0x51bdb9)
|
||||
.forGoggles(tooltip);
|
||||
}
|
||||
|
||||
TFMGUtils.createFluidTooltip(this,tooltip);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -332,7 +441,8 @@ public class RegularEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
W("engine_w", pistonsW(), 1.3f, 1.1f, 0.5f),
|
||||
U("engine_u", pistonsU(), 1, 1.5f, 0.9f, true),
|
||||
BOXER("engine_boxer", pistonsBoxer(), 1, 0.8f, 1.2f),
|
||||
RADIAL("radial", pistonsRadial(), 1, 0.8f, 1.2f);
|
||||
RADIAL("radial", pistonsRadial(), 1, 0.8f, 1.2f),
|
||||
TURBINE("turbine", pistonsTurbine(), 1.5f, 1.5f, 0.5f);
|
||||
public final float speedModifier;
|
||||
public final float torqueModifier;
|
||||
public final float effeciencyModifier;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.drmangotea.tfmg.content.engines.types.regular_engine;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineRenderer;
|
||||
import com.drmangotea.tfmg.content.engines.types.AbstractSmallEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.types.turbine_engine.TurbineEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
@@ -24,7 +25,8 @@ public class RegularEngineRenderer extends EngineRenderer {
|
||||
@Override
|
||||
protected void renderSafe(AbstractSmallEngineBlockEntity be1, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
|
||||
RegularEngineBlockEntity be = (RegularEngineBlockEntity) be1;
|
||||
|
||||
if(be instanceof TurbineEngineBlockEntity)
|
||||
return;
|
||||
BlockState blockState = be.getBlockState();
|
||||
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.cutoutMipped());
|
||||
@@ -57,6 +59,7 @@ public class RegularEngineRenderer extends EngineRenderer {
|
||||
case I, U, BOXER -> TFMGPartialModels.SMALL_CYLINDER;
|
||||
case V, W -> TFMGPartialModels.CYLINDER;
|
||||
case RADIAL -> TFMGPartialModels.RADIAL_ENGINE_CYLINDER;
|
||||
case TURBINE -> null;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.drmangotea.tfmg.content.engines.types.turbine_engine;
|
||||
import com.drmangotea.tfmg.base.TFMGShapes;
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineBlock;
|
||||
import com.drmangotea.tfmg.content.engines.types.radial_engine.RadialEngineBlock;
|
||||
import com.drmangotea.tfmg.content.engines.types.regular_engine.RegularEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -15,39 +17,28 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class TurbineEngineBlock extends EngineBlock implements IBE<TurbineEngineBlockEntity> {
|
||||
public class TurbineEngineBlock extends RadialEngineBlock {
|
||||
public TurbineEngineBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlace(BlockState pState, Level level, BlockPos pos, BlockState pOldState, boolean pIsMoving) {
|
||||
withBlockEntityDo(level, pos, IElectric::onPlaced);
|
||||
}
|
||||
@Override
|
||||
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
IBE.onRemove(state, level, pos, newState);
|
||||
public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face) {
|
||||
return face==state.getValue(SHAFT_FACING)&&(state.getValue(ENGINE_STATE)==EngineState.BACK||state.getValue(ENGINE_STATE)==EngineState.SINGLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter p_60556_, BlockPos pos, CollisionContext p_60558_) {
|
||||
return switch (state.getValue(ENGINE_STATE)){
|
||||
case NORMAL -> TFMGShapes.TURBINE_ENGINE_MIDDLE.get(state.getValue(SHAFT_FACING));
|
||||
case SHAFT, SINGLE -> TFMGShapes.TURBINE_ENGINE_BACK.get(state.getValue(SHAFT_FACING));
|
||||
case BACK -> TFMGShapes.TURBINE_ENGINE_FRONT.get(state.getValue(SHAFT_FACING));
|
||||
case BACK, SINGLE -> TFMGShapes.TURBINE_ENGINE_BACK.get(state.getValue(SHAFT_FACING).getOpposite());
|
||||
case SHAFT -> TFMGShapes.TURBINE_ENGINE_FRONT.get(state.getValue(SHAFT_FACING).getOpposite());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face) {
|
||||
return face==state.getValue(SHAFT_FACING)&&state.getValue(ENGINE_STATE)==EngineState.BACK;
|
||||
}
|
||||
@Override
|
||||
public Class<TurbineEngineBlockEntity> getBlockEntityClass() {
|
||||
return TurbineEngineBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends TurbineEngineBlockEntity> getBlockEntityType() {
|
||||
public BlockEntityType<? extends RegularEngineBlockEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.TURBINE_ENGINE.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.drmangotea.tfmg.content.engines.types.turbine_engine;
|
||||
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineBlock;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineComponentsInventory;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineProperties;
|
||||
import com.drmangotea.tfmg.content.engines.types.AbstractSmallEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.types.radial_engine.RadialEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.types.regular_engine.RegularEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.drmangotea.tfmg.registry.TFMGTags;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.foundation.item.SmartInventory;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -21,152 +19,83 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.drmangotea.tfmg.content.engines.base.EngineBlock.ENGINE_STATE;
|
||||
import static com.drmangotea.tfmg.content.engines.base.EngineBlock.EngineState.*;
|
||||
import static com.drmangotea.tfmg.content.engines.base.EngineBlock.SHAFT_FACING;
|
||||
import static com.simibubi.create.content.kinetics.base.HorizontalKineticBlock.HORIZONTAL_FACING;
|
||||
|
||||
public class TurbineEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
|
||||
public SmartInventory turbineBladeInventory;
|
||||
public class TurbineEngineBlockEntity extends RegularEngineBlockEntity {
|
||||
|
||||
public TurbineEngineBlockEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
super(typeIn, pos, state);
|
||||
componentsInventory = new EngineComponentsInventory(this, EngineProperties.turbineEngineComponents());
|
||||
turbineBladeInventory = createInventory();
|
||||
componentsInventory = new EngineComponentsInventory(this, EngineProperties.turbineEngineComponents());
|
||||
}
|
||||
|
||||
public SmartInventory createInventory() {
|
||||
return new SmartInventory(4, this)
|
||||
.withMaxStackSize(1)
|
||||
.whenContentsChanged(this::onInventoryChanged);
|
||||
}
|
||||
public void updateInventory() {
|
||||
turbineBladeInventory = createInventory();
|
||||
}
|
||||
@Override
|
||||
public boolean canWork() {
|
||||
public boolean canGenerateSpeed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (level.getBlockEntity(controller) instanceof TurbineEngineBlockEntity controller) {
|
||||
//@Override
|
||||
//public List<TagKey<Fluid>> getSupportedFuels() {
|
||||
// List<TagKey<Fluid>> list = new ArrayList<>();
|
||||
// list.add(TFMGTags.TFMGFluidTags.KEROSENE.tag);
|
||||
// return list;
|
||||
//}
|
||||
public boolean isCorrectCylinder(ItemStack itemStack) {
|
||||
return itemStack.is(TFMGItems.TURBINE_BLADE.get());
|
||||
}
|
||||
// @Override
|
||||
// public float getGeneratedSpeed() {
|
||||
//
|
||||
// float speed;
|
||||
//
|
||||
// if (hasLevel())
|
||||
//
|
||||
// if (level.getBlockEntity(controller) instanceof AbstractEngineBlockEntity controller) {
|
||||
// if (controller.fuelTank.isEmpty())
|
||||
// return 0;
|
||||
// if (!controller.canWork())
|
||||
// return 0;
|
||||
// speed = rpm / 40;
|
||||
// if (reverse)
|
||||
// speed = speed * -1;
|
||||
//
|
||||
// return convertToDirection(Math.min((int) speed, 256), getBlockState().getValue(HORIZONTAL_FACING));
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
for (Long position : controller.getAllEngines()) {
|
||||
|
||||
if (level.getBlockEntity(BlockPos.of(position)) instanceof TurbineEngineBlockEntity be) {
|
||||
for(int i =0;i<be.turbineBladeInventory.getSlots();i++){
|
||||
if(be.turbineBladeInventory.getItem(i).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EngineType getDefaultEngineType() {
|
||||
return EngineType.TURBINE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTwoShafts() {
|
||||
return false;
|
||||
}
|
||||
private void onInventoryChanged(int integer) {
|
||||
updateRotation();
|
||||
sendData();
|
||||
setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertItem(ItemStack itemStack, boolean shifting, Player player, InteractionHand hand) {
|
||||
|
||||
|
||||
|
||||
if (itemStack.is(TFMGItems.SCREWDRIVER.get())) {
|
||||
if (!turbineBladeInventory.isEmpty()) {
|
||||
for (int i = 0; i < turbineBladeInventory.getSlots(); i++) {
|
||||
if (!turbineBladeInventory.getItem(i).isEmpty()) {
|
||||
dropItem(turbineBladeInventory.getItem(i));
|
||||
turbineBladeInventory.setItem(i, ItemStack.EMPTY);
|
||||
playRemovalSound();
|
||||
updateRotation();
|
||||
setChanged();
|
||||
sendData();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = componentsInventory.components.size() - 1; i >= 0; i--) {
|
||||
if (!componentsInventory.getItem(i).isEmpty()) {
|
||||
dropItem(componentsInventory.getItem(i));
|
||||
componentsInventory.setItem(i, ItemStack.EMPTY);
|
||||
playRemovalSound();
|
||||
updateRotation();
|
||||
setChanged();
|
||||
sendData();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (hasAllComponents())
|
||||
if (itemStack.is(TFMGItems.TURBINE_BLADE.get())) {
|
||||
for (int i = turbineBladeInventory.getSlots() - 1; i >= 0; i--) {
|
||||
if (turbineBladeInventory.getItem(i).isEmpty()) {
|
||||
ItemStack toInsert = itemStack.copy();
|
||||
toInsert.setCount(1);
|
||||
turbineBladeInventory.setItem(i, toInsert);
|
||||
itemStack.shrink(1);
|
||||
playInsertionSound();
|
||||
updateRotation();
|
||||
setChanged();
|
||||
sendData();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nextComponent().test(itemStack) && !isController()) {
|
||||
|
||||
if (level.getBlockEntity(controller) instanceof AbstractSmallEngineBlockEntity be) {
|
||||
return be.insertItem(itemStack, shifting, player, hand);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return super.insertItem(itemStack, shifting, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneratedSpeed() {
|
||||
|
||||
float speed;
|
||||
|
||||
if (hasLevel())
|
||||
|
||||
if (level.getBlockEntity(controller) instanceof AbstractEngineBlockEntity controller) {
|
||||
if (controller.fuelTank.isEmpty())
|
||||
return 0;
|
||||
if (!controller.canWork())
|
||||
return 0;
|
||||
speed = rpm / 40;
|
||||
if (reverse)
|
||||
speed = speed * -1;
|
||||
|
||||
return convertToDirection(Math.min((int) speed, 256), getBlockState().getValue(HORIZONTAL_FACING));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void write(CompoundTag compound, boolean clientPacket) {
|
||||
super.write(compound, clientPacket);
|
||||
|
||||
compound.put("TurbineBlades", turbineBladeInventory.serializeNBT());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
turbineBladeInventory.deserializeNBT(compound.getCompound("TurbineBlades"));
|
||||
}
|
||||
|
||||
public void setBlockStates(AbstractSmallEngineBlockEntity be, BlockPos last) {
|
||||
|
||||
Direction facing = getBlockState().getValue(SHAFT_FACING).getOpposite();
|
||||
|
||||
if(level.getBlockState(getBlockPos().relative(facing)).getBlock()!=this.getBlockState().getBlock()&&level.getBlockState(getBlockPos().relative(facing.getOpposite())).getBlock()!=this.getBlockState().getBlock()){
|
||||
level.setBlock(getBlockPos(), level.getBlockState(getBlockPos()).setValue(ENGINE_STATE, SINGLE), 2);
|
||||
return;
|
||||
}
|
||||
|
||||
//if(level.getBlockState(getBlockPos().relative(facing.getOpposite())).getBlock()!=this.getBlockState().getBlock()&&isController()){
|
||||
// level.setBlock(getBlockPos(), level.getBlockState(getBlockPos()).setValue(ENGINE_STATE, SINGLE), 2);
|
||||
// return;
|
||||
//}
|
||||
|
||||
if(last!=null){
|
||||
level.setBlock(last, level.getBlockState(last).setValue(ENGINE_STATE, BACK), 2);
|
||||
return;
|
||||
@@ -180,29 +109,4 @@ public class TurbineEngineBlockEntity extends AbstractSmallEngineBlockEntity {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagKey<Fluid>> getSupportedFuels() {
|
||||
return List.of(TFMGTags.TFMGFluidTags.KEROSENE.tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float efficiencyModifier() {
|
||||
return getFuelType().getEfficiency() * getUpgradeEfficiencyModifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float speedModifier() {
|
||||
return getFuelType().getSpeed() * getUpgradeSpeedModifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float torqueModifier() {
|
||||
return getFuelType().getStress() * getUpgradeTorqueModifier();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String engineId() {
|
||||
return "turbine";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.drmangotea.tfmg.content.machinery.metallurgy.blast_furnace;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.config.TFMGConfigs;
|
||||
import com.drmangotea.tfmg.datagen.TFMGDamageSources;
|
||||
@@ -10,7 +9,6 @@ import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.drmangotea.tfmg.registry.TFMGRecipeTypes;
|
||||
import com.drmangotea.tfmg.registry.TFMGTags;
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
@@ -18,7 +16,6 @@ import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
import com.simibubi.create.foundation.item.SmartInventory;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.ChatFormatting;
|
||||
@@ -33,7 +30,6 @@ import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
@@ -123,7 +119,7 @@ public class BlastFurnaceOutputBlockEntity extends SmartBlockEntity implements I
|
||||
CreateLang.translate("goggles.blast_furnace.fuel_amount", fuel)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
if(isReinforced)
|
||||
if (isReinforced)
|
||||
CreateLang.translate("goggles.blast_furnace.reinforced")
|
||||
.style(ChatFormatting.GREEN)
|
||||
.forGoggles(tooltip);
|
||||
@@ -144,9 +140,9 @@ public class BlastFurnaceOutputBlockEntity extends SmartBlockEntity implements I
|
||||
return;
|
||||
|
||||
IndustrialBlastingRecipe recipe = optional.get();
|
||||
|
||||
if (!(recipe.getIngredients().get(1).test(fluxInventory.getItem(0))))
|
||||
return;
|
||||
if (recipe.getIngredients().size() > 1)
|
||||
if (!(recipe.getIngredients().get(1).test(fluxInventory.getItem(0))))
|
||||
return;
|
||||
|
||||
if (fluxInventory.getItem(0).getCount() < recipe.getIngredients().size() - 1)
|
||||
return;
|
||||
@@ -158,8 +154,8 @@ public class BlastFurnaceOutputBlockEntity extends SmartBlockEntity implements I
|
||||
double timeModifier = maxHeigth / ((baseDuration / 2) * maxTimeModifier);
|
||||
|
||||
timer = (int) (baseDuration - (heigth / timeModifier));
|
||||
if(isReinforced)
|
||||
timer /=2;
|
||||
if (isReinforced)
|
||||
timer /= 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,12 +193,18 @@ public class BlastFurnaceOutputBlockEntity extends SmartBlockEntity implements I
|
||||
int itemsUsed = 1;
|
||||
int fluxUsed = 1;
|
||||
|
||||
if (!(primaryTank.getSpace() >= recipe.getPrimaryResult().getAmount()) || !(secondaryTank.getSpace() >= recipe.getSecondaryResult().getAmount()))
|
||||
if (!(primaryTank.getSpace() >= recipe.getPrimaryResult().getAmount()))
|
||||
return;
|
||||
if (recipe.getFluidResults().size() > 1)
|
||||
if (!(secondaryTank.getSpace() >= recipe.getSecondaryResult().getAmount()))
|
||||
return;
|
||||
|
||||
inputInventory.getItem(0).shrink(1);
|
||||
fluxInventory.getItem(0).shrink(recipe.getIngredients().size() - 1);
|
||||
if (recipe.getIngredients().size() > 1)
|
||||
fluxInventory.getItem(0).shrink(recipe.getIngredients().size() - 1);
|
||||
primaryTank.fill(recipe.getPrimaryResult(), IFluidHandler.FluidAction.EXECUTE);
|
||||
secondaryTank.fill(recipe.getSecondaryResult(), IFluidHandler.FluidAction.EXECUTE);
|
||||
if (recipe.getFluidResults().size() > 1)
|
||||
secondaryTank.fill(recipe.getSecondaryResult(), IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
timer = -1;
|
||||
|
||||
@@ -256,12 +258,6 @@ public class BlastFurnaceOutputBlockEntity extends SmartBlockEntity implements I
|
||||
if (fuel == 0)
|
||||
return false;
|
||||
|
||||
Fluid fluidNeeded1 = recipe.getFluidResults().get(0).getFluid();
|
||||
Fluid fluidNeeded2 = recipe.getFluidResults().get(1).getFluid();
|
||||
|
||||
Fluid fluidContained1 = primaryTank.getFluid().getFluid();
|
||||
Fluid fluidContained2 = secondaryTank.getFluid().getFluid();
|
||||
|
||||
if (!primaryTank.getFluid().isEmpty() && !primaryTank.getFluid().getFluid().isSame(recipe.getPrimaryResult().getFluid()))
|
||||
return false;
|
||||
if (!secondaryTank.getFluid().isEmpty() && !secondaryTank.getFluid().getFluid().isSame(recipe.getSecondaryResult().getFluid()))
|
||||
@@ -391,7 +387,7 @@ public class BlastFurnaceOutputBlockEntity extends SmartBlockEntity implements I
|
||||
if (checkedPos.getX() == middlePos.getX() ^ checkedPos.getZ() == middlePos.getZ()) {
|
||||
if (!(i == 0 && level.getBlockState(checkedPos).is(TFMGBlocks.BLAST_FURNACE_OUTPUT.get()))) {
|
||||
if (wall == FurnaceBlockType.NONE) {
|
||||
isReinforced = normalAmount ==0&&reinforcedAmount>0;
|
||||
isReinforced = normalAmount == 0 && reinforcedAmount > 0;
|
||||
return size;
|
||||
} else {
|
||||
if (wall == FurnaceBlockType.REGULAR) {
|
||||
@@ -401,12 +397,12 @@ public class BlastFurnaceOutputBlockEntity extends SmartBlockEntity implements I
|
||||
}
|
||||
} else if (checkedPos.getX() == middlePos.getX() && checkedPos.getZ() == middlePos.getZ()) {
|
||||
if (!level.getBlockState(checkedPos).isAir() && i != 0) {
|
||||
isReinforced = normalAmount ==0&&reinforcedAmount>0;
|
||||
isReinforced = normalAmount == 0 && reinforcedAmount > 0;
|
||||
|
||||
return size;
|
||||
}
|
||||
} else if (support == FurnaceBlockType.NONE) {
|
||||
isReinforced = normalAmount ==0&&reinforcedAmount>0;
|
||||
isReinforced = normalAmount == 0 && reinforcedAmount > 0;
|
||||
return size;
|
||||
} else {
|
||||
if (support == FurnaceBlockType.REGULAR) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING;
|
||||
|
||||
@@ -127,6 +128,8 @@ public class CastingBasinBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
ItemHelper.dropContents(level, worldPosition, inventory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
TFMGUtils.createFluidTooltip(this, tooltip);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.recipes.PolarizingRecipe;
|
||||
import com.drmangotea.tfmg.recipes.WindingRecipe;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.drmangotea.tfmg.registry.TFMGRecipeTypes;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
@@ -164,14 +165,18 @@ public class WindingMachineBlockEntity extends KineticBlockEntity implements IHa
|
||||
if (getSpeed() == 0)
|
||||
return;
|
||||
if (inventory.getItem(0).is(TFMGItems.ELECTROMAGNETIC_COIL.get()) && spool.is(TFMGItems.COPPER_SPOOL.get()) && spool.getOrCreateTag().getInt("Amount") > 0 && inventory.getItem(0).getOrCreateTag().getInt("Turns") < turnPercentage.getValue() * 10) {
|
||||
spool.getOrCreateTag().putInt("Amount", spool.getOrCreateTag().getInt("Amount") - 1);
|
||||
inventory.getItem(0).getOrCreateTag().putInt("Turns", inventory.getItem(0).getOrCreateTag().getInt("Turns") + 1);
|
||||
return;
|
||||
if(inventory.getItem(0).getOrCreateTag().getInt("Turns")< turnPercentage.getValue()*10){
|
||||
spool.getOrCreateTag().putInt("Amount", spool.getOrCreateTag().getInt("Amount") - 1);
|
||||
inventory.getItem(0).getOrCreateTag().putInt("Turns", inventory.getItem(0).getOrCreateTag().getInt("Turns") + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (inventory.getItem(0).is(TFMGItems.UNFINISHED_RESISTOR.get()) && spool.is(TFMGItems.CONSTANTAN_SPOOL.get()) && spool.getOrCreateTag().getInt("Amount") > 0 && inventory.getItem(0).getOrCreateTag().getInt("Resistance") < turnPercentage.getValue() * 10) {
|
||||
spool.getOrCreateTag().putInt("Amount", spool.getOrCreateTag().getInt("Amount") - 1);
|
||||
inventory.getItem(0).getOrCreateTag().putInt("Resistance", inventory.getItem(0).getOrCreateTag().getInt("Resistance") + 1);
|
||||
return;
|
||||
if (inventory.getItem(0).is(TFMGBlocks.RESISTOR.asItem()) && spool.is(TFMGItems.CONSTANTAN_SPOOL.get()) && spool.getOrCreateTag().getInt("Amount") > 0 && inventory.getItem(0).getOrCreateTag().getInt("Resistance") < turnPercentage.getValue() * 10) {
|
||||
if(inventory.getItem(0).getOrCreateTag().getInt("Resistance")< turnPercentage.getValue()*10) {
|
||||
spool.getOrCreateTag().putInt("Amount", spool.getOrCreateTag().getInt("Amount") - 1);
|
||||
inventory.getItem(0).getOrCreateTag().putInt("Resistance", inventory.getItem(0).getOrCreateTag().getInt("Resistance") + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.createmod.catnip.lang.LangBuilder;
|
||||
import net.createmod.catnip.theme.Color;
|
||||
import net.createmod.ponder.api.level.PonderLevel;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -155,7 +156,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
|
||||
}
|
||||
|
||||
updateTemperature();
|
||||
if (level.isClientSide&&!(level instanceof PonderLevel)) {
|
||||
if (level.isClientSide && !(level instanceof PonderLevel)) {
|
||||
int tankNumber = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
IFluidHandler fluidHandler = this.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null);
|
||||
@@ -281,7 +282,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
if (!found) {
|
||||
doesntMatch = true;
|
||||
break;
|
||||
}
|
||||
@@ -372,7 +373,6 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
|
||||
super.tick();
|
||||
|
||||
|
||||
|
||||
handleRecipe();
|
||||
|
||||
if (syncCooldown > 0) {
|
||||
@@ -488,7 +488,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
|
||||
for (int i = 0; i < outputFluidHandler.getTanks(); i++) {
|
||||
FluidStack fluidInTank = outputFluidHandler.getFluidInTank(i);
|
||||
if (fluidInTank.getFluid().isSame(fluidStack.getFluid())) {
|
||||
outputFluidHandler.fill(new FluidStack(fluidStack.copy(), fluidStack.getAmount() + fluidInTank.getAmount()), IFluidHandler.FluidAction.EXECUTE);
|
||||
outputFluidHandler.fill(new FluidStack(fluidStack.copy(), fluidStack.getAmount()), IFluidHandler.FluidAction.EXECUTE);
|
||||
handledFluidResults.add(i);
|
||||
break;
|
||||
}
|
||||
@@ -496,7 +496,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
|
||||
for (int i = 0; i < outputFluidHandler.getTanks(); i++) {
|
||||
FluidStack fluidInTank = outputFluidHandler.getFluidInTank(i);
|
||||
if (!handledFluidResults.contains(i) && fluidInTank.isEmpty()) {
|
||||
outputFluidHandler.fill(new FluidStack(fluidStack.copy(), fluidStack.getAmount() + fluidInTank.getAmount()), IFluidHandler.FluidAction.EXECUTE);
|
||||
outputFluidHandler.fill(new FluidStack(fluidStack.copy(), fluidStack.getAmount()), IFluidHandler.FluidAction.EXECUTE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -508,6 +508,10 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public BlockPos getLastKnownPos() {
|
||||
return lastKnownPos;
|
||||
@@ -851,15 +855,33 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
CreateLang.text("Speed " + efficiency * 100 + "%").forGoggles(tooltip);
|
||||
CreateLang.text("Heat " + heatLevel).forGoggles(tooltip);
|
||||
for (String operation : machines)
|
||||
CreateLang.text(operation).forGoggles(tooltip);
|
||||
|
||||
|
||||
CreateLang.translate("gui.goggles.basin_contents")
|
||||
if(!isController())
|
||||
return getControllerBE().addToGoggleTooltip(tooltip,isPlayerSneaking);
|
||||
CreateLang.translate("goggles.vat.header")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
CreateLang.translate("goggles.vat.contents")
|
||||
.forGoggles(tooltip);
|
||||
|
||||
CreateLang.translate("goggles.vat.attachments")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
for (String operation : machines)
|
||||
CreateLang.translate("goggles.vat."+operation.replace(":","."))
|
||||
.forGoggles(tooltip);
|
||||
|
||||
|
||||
CreateLang.translate("goggles.vat.heat_status")
|
||||
.add(CreateLang.translate(heatCondition == HeatCondition.NONE ? "goggles.vat.no_heat" : heatCondition == HeatCondition.HEATED ? "goggles.vat.heated" : "goggles.vat.superheated"))
|
||||
.color(heatCondition == HeatCondition.NONE ? 0x7a7a77 : heatCondition == HeatCondition.HEATED ? 0xdea216 : 0x16c7de)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
CreateLang.translate("goggles.vat.contents")
|
||||
.forGoggles(tooltip);
|
||||
|
||||
///
|
||||
|
||||
IItemHandlerModifiable items = itemCapability.orElse(new ItemStackHandler());
|
||||
IFluidHandler fluids = fluidCapability.orElse(new FluidTank(0));
|
||||
boolean isEmpty = true;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
|
||||
if (electrodeType != ElectrodeType.NONE) {
|
||||
if(electrodeType == ElectrodeType.GRAPHITE) {
|
||||
return 200;
|
||||
return 300;
|
||||
}else return 100;
|
||||
}
|
||||
|
||||
@@ -86,9 +86,7 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
VatBlock.updateVatState(getBlockState(), level, getBlockPos().relative(Direction.DOWN));
|
||||
}
|
||||
|
||||
boolean isSuperheated() {
|
||||
return electrodeType == ElectrodeType.GRAPHITE && getCurrent() >= TFMGConfigs.common().machines.graphiteElectrodeCurrent.get();
|
||||
}
|
||||
|
||||
|
||||
boolean isOperational() {
|
||||
return getCurrent() >= TFMGConfigs.common().machines.electrolysisMinimumCurrent.get()&&canWork();
|
||||
@@ -126,7 +124,7 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
|
||||
case NONE -> "";
|
||||
case COPPER, ZINC -> isOperational() ? "tfmg:electrode" : "";
|
||||
case GRAPHITE -> isSuperheated() ? "tfmg:graphite_electrode" : isOperational() ? "tfmg:electrode" : "";
|
||||
case GRAPHITE -> isOperational() ? "tfmg:graphite_electrode" : "";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ElectrodeHolderRenderer extends SafeBlockEntityRenderer<ElectrodeHo
|
||||
return;
|
||||
|
||||
|
||||
CachedBuffers.partial(be.isSuperheated() ? TFMGPartialModels.GRAPHITE_ELECTRODE_SUPERHEATED : be.electrodeType.model, blockState)
|
||||
CachedBuffers.partial(be.electrodeType.model, blockState)
|
||||
.light(LevelRenderer.getLightColor(be.getLevel(), be.getBlockPos().below()))
|
||||
.translateY(-1)
|
||||
.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
@@ -355,9 +356,6 @@ public class TFMGRecipeProvider extends RecipeProvider {
|
||||
public static ItemLike plasticPipe() {
|
||||
return TFMGPipes.TFMG_PIPES.get(TFMGPipes.PipeMaterial.PLASTIC).get(0);
|
||||
}
|
||||
public static ItemLike turbineBlade() {
|
||||
return TFMGItems.TURBINE_BLADE.get();
|
||||
}
|
||||
public static ItemLike magneticIngot() {
|
||||
return TFMGItems.MAGNETIC_ALLOY_INGOT.get();
|
||||
}
|
||||
@@ -598,12 +596,12 @@ public class TFMGRecipeProvider extends RecipeProvider {
|
||||
}
|
||||
|
||||
|
||||
public static Ingredient resistor10Ohms(){
|
||||
public static ItemStack resistor10Ohms(){
|
||||
ItemStack stack = TFMGBlocks.RESISTOR.asStack();
|
||||
|
||||
stack.getOrCreateTag().putInt("Resistance",10);
|
||||
|
||||
return Ingredient.of(stack);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack coil100Turns(){
|
||||
@@ -612,6 +610,20 @@ public class TFMGRecipeProvider extends RecipeProvider {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack turbineBlade(){
|
||||
ItemStack stack = TFMGItems.TURBINE_BLADE.asStack();
|
||||
|
||||
CompoundTag keroseneTag = new CompoundTag();
|
||||
keroseneTag.putString("kerosene", "forge:kerosene");
|
||||
CompoundTag keroseneTagName = new CompoundTag();
|
||||
keroseneTagName.putString("kerosene", "Kerosene");
|
||||
|
||||
stack.getOrCreateTag().put("Fuels", keroseneTag);
|
||||
stack.getOrCreateTag().put("FuelNames", keroseneTagName);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,14 @@ import com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.drmangotea.tfmg.registry.TFMGRecipeTypes;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.content.decoration.palettes.AllPaletteBlocks;
|
||||
import com.simibubi.create.foundation.data.recipe.CompatMetals;
|
||||
import com.simibubi.create.foundation.data.recipe.Mods;
|
||||
@@ -673,14 +675,6 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
|
||||
.pattern(" A ")
|
||||
.pattern(" ")),
|
||||
|
||||
TURBINE = create(TFMGItems.TURBINE_BLADE).returns(2)
|
||||
.unlockedBy(AllItems.IRON_SHEET::get)
|
||||
.viaShaped(b -> b
|
||||
.define('S', shaft())
|
||||
.define('P', ironSheet())
|
||||
.pattern("PPP")
|
||||
.pattern("PSP")
|
||||
.pattern("PPP")),
|
||||
|
||||
CABLE_TUBE = create(TFMGBlocks.CABLE_TUBE)
|
||||
.unlockedBy(TFMGItems.RUBBER_SHEET::get)
|
||||
@@ -733,16 +727,16 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
|
||||
.pattern("LCL")
|
||||
.pattern("RPR")),
|
||||
|
||||
FUSE_BLOCK = create(TFMGBlocks.FUSE_BLOCK)
|
||||
.unlockedBy(TFMGItems.COPPER_WIRE::get)
|
||||
.viaShaped(b -> b
|
||||
.define('C', heavyMachineryCasing())
|
||||
.define('W', copperWire())
|
||||
.define('R', aluminumSheet())
|
||||
.define('L', copperIngot())
|
||||
.pattern("RWR")
|
||||
.pattern("LCL")
|
||||
.pattern("RWR")),
|
||||
// FUSE_BLOCK = create(TFMGBlocks.FUSE_BLOCK)
|
||||
// .unlockedBy(TFMGItems.COPPER_WIRE::get)
|
||||
// .viaShaped(b -> b
|
||||
// .define('C', heavyMachineryCasing())
|
||||
// .define('W', copperWire())
|
||||
// .define('R', aluminumSheet())
|
||||
// .define('L', copperIngot())
|
||||
// .pattern("RWR")
|
||||
// .pattern("LCL")
|
||||
// .pattern("RWR")),
|
||||
|
||||
SEGMENTED_DISPLAY = create(TFMGBlocks.SEGMENTED_DISPLAY).returns(4)
|
||||
.unlockedBy(TFMGBlocks.ALUMINUM_CASING::get)
|
||||
@@ -1153,6 +1147,26 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
|
||||
.pattern("BFP")
|
||||
.pattern("PPP")),
|
||||
|
||||
CINDERBLOCK = create(TFMGBlocks.CINDER_BLOCK).returns(8)
|
||||
.unlockedBy(TFMGItems.CINDERBLOCK::get)
|
||||
.viaShaped(b -> b
|
||||
.define('C', TFMGFluids.LIQUID_CONCRETE.getBucket().get())
|
||||
.define('B', TFMGItems.CINDERBLOCK)
|
||||
.define('R', rebar())
|
||||
.pattern("BBB")
|
||||
.pattern("RCR")
|
||||
.pattern("BBB")),
|
||||
|
||||
CINDERFLOURBLOCK = create(TFMGBlocks.CINDERFLOUR_BLOCK).returns(8)
|
||||
.unlockedBy(TFMGItems.CINDERFLOURBLOCK::get)
|
||||
.viaShaped(b -> b
|
||||
.define('C', Blocks.NETHER_WART_BLOCK)
|
||||
.define('B', TFMGItems.CINDERFLOURBLOCK)
|
||||
.define('R', rebar())
|
||||
.pattern("BBB")
|
||||
.pattern("RCR")
|
||||
.pattern("BBB")),
|
||||
|
||||
TRANSFORMER = create(TFMGBlocks.TRANSFORMER)
|
||||
.unlockedBy(TFMGBlocks.STEEL_CASING::get)
|
||||
.viaShaped(b -> b
|
||||
@@ -1540,6 +1554,24 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
|
||||
.pattern("BAB")
|
||||
.pattern("BAB")),
|
||||
|
||||
RESISTOR = create(TFMGItems.UNFINISHED_RESISTOR)
|
||||
.unlockedBy(TFMGItems.ALUMINUM_INGOT::get)
|
||||
.viaShaped(b -> b
|
||||
.define('W', copperWire())
|
||||
.define('P', plasticSheet())
|
||||
.pattern(" W ")
|
||||
.pattern(" P ")
|
||||
.pattern(" W ")),
|
||||
|
||||
RESISTOR_FROM_SLIME = create(TFMGItems.UNFINISHED_RESISTOR).withSuffix("from_slime")
|
||||
.unlockedBy(TFMGItems.ALUMINUM_INGOT::get)
|
||||
.viaShaped(b -> b
|
||||
.define('W', copperWire())
|
||||
.define('P', Items.SLIME_BALL)
|
||||
.pattern(" W ")
|
||||
.pattern(" P ")
|
||||
.pattern(" W ")),
|
||||
|
||||
MIXER_BLADE = create(TFMGItems.MIXER_BLADE)
|
||||
.unlockedBy(TFMGItems.HEAVY_PLATE::get)
|
||||
.viaShaped(b -> b
|
||||
@@ -2270,6 +2302,8 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
|
||||
return new Marker();
|
||||
}
|
||||
|
||||
|
||||
|
||||
GeneratedRecipeBuilder create(Supplier<ItemLike> result) {
|
||||
return new GeneratedRecipeBuilder(currentFolder, result);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,10 @@ public class TFMGCrushingRecipeGen extends TFMGProcessingRecipeGen {
|
||||
SALTPETER = create(I::dirt, b -> b
|
||||
.output(.05f, nitrateDust(), 1)
|
||||
),
|
||||
|
||||
GALENA = create(TFMGPaletteStoneTypes.GALENA.getBaseBlock()::get, b -> b
|
||||
.output(.4f, crushedRawLead(), 1)
|
||||
.output(.1f, TFMGItems.LEAD_NUGGET, 2)
|
||||
),
|
||||
SULFUR = create(() -> TFMGBlocks.SULFUR, b -> b
|
||||
.output(.2f, sulfurDust(), 1)
|
||||
.output(.1f, sulfurDust(), 1)
|
||||
|
||||
@@ -26,6 +26,13 @@ public class TFMGMixingRecipeGen extends TFMGProcessingRecipeGen {
|
||||
.output(cement(),4)
|
||||
),
|
||||
|
||||
CONSTANTAN = create("constantan", b -> b
|
||||
.require(copperIngot())
|
||||
.require(nickelIngot())
|
||||
.output(TFMGItems.CONSTANTAN_INGOT,2)
|
||||
.requiresHeat(HeatCondition.HEATED)
|
||||
),
|
||||
|
||||
ASPHALT_MIXTURE = create("asphalt_mixture", b -> b
|
||||
.require(sand())
|
||||
.require(bitumen())
|
||||
@@ -72,6 +79,18 @@ public class TFMGMixingRecipeGen extends TFMGProcessingRecipeGen {
|
||||
.output(liquidAsphalt(),1000)
|
||||
),
|
||||
|
||||
P_SEMICONDUCTOR = create("p_semiconductor", b -> b
|
||||
.require(aluminumIngot())
|
||||
.require(TFMGItems.SILICON_INGOT)
|
||||
.output(TFMGItems.P_SEMICONDUCTOR)
|
||||
),
|
||||
|
||||
N_SEMICONDUCTOR = create("n_semiconductor", b -> b
|
||||
.require(sulfurDust())
|
||||
.require(TFMGItems.SILICON_INGOT)
|
||||
.output(TFMGItems.N_SEMICONDUCTOR)
|
||||
),
|
||||
|
||||
GUNPOWDER = create("gunpowder", b -> b
|
||||
.require(nitrateDust())
|
||||
.require(nitrateDust())
|
||||
@@ -97,6 +116,7 @@ public class TFMGMixingRecipeGen extends TFMGProcessingRecipeGen {
|
||||
MAGNETIC_ALLOY = create("magnetic_alloy", b -> b
|
||||
.require(nickelIngot())
|
||||
.require(nickelIngot())
|
||||
.require(TFMGItems.SILICON_INGOT)
|
||||
.require(steelIngot())
|
||||
.require(steelIngot())
|
||||
.output(magneticIngot())
|
||||
|
||||
@@ -71,6 +71,21 @@ public class TFMGSequencedAssemblyRecipeGen extends CreateRecipeProvider {
|
||||
|
||||
),
|
||||
|
||||
STEEL_MECHANISM = create("steel_mechanism", b -> b.require(TFMGItems.HEAVY_PLATE)
|
||||
.transitionTo(TFMGItems.UNFINISHED_STEEL_MECHANISM.get())
|
||||
.addOutput(TFMGItems.STEEL_MECHANISM.get(), 120)
|
||||
.addOutput(Items.COMPASS, 4)
|
||||
.addOutput(TFMGItems.STEEL_INGOT, 4)
|
||||
.loops(2)
|
||||
.addStep(DeployerApplicationRecipe::new, rb -> rb.require(TFMGBlocks.STEEL_COGWHEEL))
|
||||
.addStep(DeployerApplicationRecipe::new, rb -> rb.require(TFMGItems.NICKEL_SHEET))
|
||||
.addStep(DeployerApplicationRecipe::new, rb -> rb.require(TFMGBlocks.LARGE_STEEL_COGWHEEL))
|
||||
.addStep(DeployerApplicationRecipe::new, rb -> rb.require(TFMGItems.LEAD_SHEET))
|
||||
.addStep(DeployerApplicationRecipe::new, rb -> rb.require(TFMGItems.SCREW))
|
||||
.addStep(DeployerApplicationRecipe::new, rb -> rb.require(TFMGItems.SCREWDRIVER))
|
||||
|
||||
),
|
||||
|
||||
MOTOR = create("motor", b -> b.require(shaft())
|
||||
.transitionTo(TFMGItems.UNFINISHED_GENERATOR.get())
|
||||
.addOutput(TFMGBlocks.ELECTRIC_MOTOR.get(), 120)
|
||||
|
||||
@@ -17,22 +17,27 @@ public class IndustrialBlastingRecipeGen extends TFMGRecipeProvider{
|
||||
|
||||
GeneratedRecipe
|
||||
|
||||
SILICON = createIndustrialBlastingRecipe("silicon", b -> (IndustrialBlastingRecipeBuilder) b
|
||||
.require(Items.QUARTZ)
|
||||
.output(TFMGFluids.LIQUID_SILICON.get(),10)
|
||||
.duration(5)
|
||||
, 0),
|
||||
|
||||
STEEL = createIndustrialBlastingRecipe("steel", b -> (IndustrialBlastingRecipeBuilder) b
|
||||
.require(AllItems.CRUSHED_IRON)
|
||||
.require(TFMGTags.TFMGItemTags.FLUX.tag)
|
||||
.output(TFMGFluids.MOLTEN_STEEL.get(),144)
|
||||
.output(TFMGFluids.MOLTEN_SLAG.get(),144)
|
||||
.output(TFMGFluids.FURNACE_GAS.get(),20)
|
||||
.duration(60)
|
||||
.duration(20)
|
||||
, 20),
|
||||
STEEL_DOUBLE = createIndustrialBlastingRecipe("steel_from_raw_iron", b -> (IndustrialBlastingRecipeBuilder) b
|
||||
.require(Items.RAW_IRON)
|
||||
.require(Ingredient.of(TFMGTags.TFMGItemTags.FLUX.tag))
|
||||
.require(Ingredient.of(TFMGTags.TFMGItemTags.FLUX.tag))
|
||||
.output(TFMGFluids.MOLTEN_STEEL.get(),288)
|
||||
.output(TFMGFluids.MOLTEN_SLAG.get(),288)
|
||||
.output(TFMGFluids.FURNACE_GAS.get(),20)
|
||||
.duration(120)
|
||||
.duration(40)
|
||||
, 30),
|
||||
|
||||
|
||||
@@ -42,7 +47,7 @@ public class IndustrialBlastingRecipeGen extends TFMGRecipeProvider{
|
||||
.output(TFMGFluids.MOLTEN_STEEL.get(),144)
|
||||
.output(TFMGFluids.MOLTEN_SLAG.get(),144)
|
||||
.output(TFMGFluids.FURNACE_GAS.get(),20)
|
||||
.duration(50)
|
||||
.duration(20)
|
||||
, 20)
|
||||
|
||||
|
||||
|
||||
@@ -34,8 +34,9 @@ public class VatRecipeGen extends TFMGRecipeProvider {
|
||||
.require(crushedRawIron())
|
||||
.require(TFMGTags.TFMGItemTags.FLUX.tag)
|
||||
.require(TFMGTags.TFMGItemTags.BLAST_FURNACE_FUEL.tag)
|
||||
.output(TFMGFluids.MOLTEN_STEEL.get(), 288)
|
||||
.output(TFMGFluids.MOLTEN_STEEL.get(), 144)
|
||||
.output(TFMGFluids.MOLTEN_SLAG.get(), 288)
|
||||
.duration(20)
|
||||
, arcBlasting()),
|
||||
NEON = createVatRecipe("neon", b -> (VatMachineRecipeBuilder) b
|
||||
.require(TFMGFluids.AIR.get(), 1000)
|
||||
|
||||
@@ -23,8 +23,8 @@ public class WindingRecipeGen extends TFMGProcessingRecipeGen {
|
||||
.duration(100)),
|
||||
RESISTOR = create("resistor", b ->b
|
||||
.require(TFMGItems.UNFINISHED_RESISTOR)
|
||||
.require(resistor10Ohms())
|
||||
.output(coil100Turns())
|
||||
.require(TFMGItems.CONSTANTAN_SPOOL)
|
||||
.output(resistor10Ohms())
|
||||
.duration(50))
|
||||
;
|
||||
public WindingRecipeGen(PackOutput output) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.drmangotea.tfmg.recipes.jei.machines.BlastFurnace;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.simibubi.create.compat.jei.category.CreateRecipeCategory;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import mezz.jei.api.forge.ForgeTypes;
|
||||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
||||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
|
||||
import mezz.jei.api.recipe.IFocusGroup;
|
||||
@@ -19,46 +18,49 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@ParametersAreNonnullByDefault
|
||||
public class IndustrialBlastingCategory extends CreateRecipeCategory<IndustrialBlastingRecipe> {
|
||||
|
||||
private final BlastFurnace blastFurnace = new BlastFurnace();
|
||||
private final BlastFurnace blastFurnace = new BlastFurnace();
|
||||
|
||||
public IndustrialBlastingCategory(Info<IndustrialBlastingRecipe> info) {
|
||||
super(info);
|
||||
}
|
||||
public IndustrialBlastingCategory(Info<IndustrialBlastingRecipe> info) {
|
||||
super(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayoutBuilder builder, IndustrialBlastingRecipe recipe, IFocusGroup focuses) {
|
||||
|
||||
|
||||
builder
|
||||
.addSlot(RecipeIngredientRole.INPUT, 25, 13)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addIngredients(recipe.getIngredients().get(0));
|
||||
if (recipe.getIngredients().size() > 1) {
|
||||
builder
|
||||
.addSlot(RecipeIngredientRole.INPUT, 5, 13)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addIngredients(recipe.getIngredients().get(1));
|
||||
}
|
||||
builder
|
||||
.addSlot(RecipeIngredientRole.INPUT, 70, 13)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addItemStack(new ItemStack(TFMGItems.COAL_COKE_DUST.get()));
|
||||
|
||||
//fluid
|
||||
addFluidSlot(builder, 140, 117, recipe.getFluidResults().get(0));
|
||||
if (recipe.getFluidResults().size() > 2)
|
||||
addFluidSlot(builder, 160, 117, recipe.getFluidResults().get(1));
|
||||
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayoutBuilder builder, IndustrialBlastingRecipe recipe, IFocusGroup focuses) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(IndustrialBlastingRecipe recipe, IRecipeSlotsView iRecipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) {
|
||||
blastFurnace
|
||||
.draw(graphics, 50, 135);
|
||||
|
||||
|
||||
builder
|
||||
.addSlot(RecipeIngredientRole.INPUT, 25, 13)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addIngredients(recipe.getIngredients().get(0));
|
||||
AllGuiTextures.JEI_ARROW.render(graphics, 96, 121);
|
||||
|
||||
builder
|
||||
.addSlot(RecipeIngredientRole.INPUT, 5, 13)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addItemStack(new ItemStack(TFMGItems.COAL_COKE_DUST.get(),2));
|
||||
AllGuiTextures.JEI_DOWN_ARROW.render(graphics, 45, 15);
|
||||
|
||||
//fluid
|
||||
addFluidSlot(builder,140,117,recipe.getFluidResults().get(0));
|
||||
addFluidSlot(builder,160,117,recipe.getFluidResults().get(1));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(IndustrialBlastingRecipe recipe, IRecipeSlotsView iRecipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) {
|
||||
blastFurnace
|
||||
.draw(graphics, 50, 135);
|
||||
|
||||
|
||||
AllGuiTextures.JEI_ARROW.render(graphics, 96, 121);
|
||||
|
||||
AllGuiTextures.JEI_DOWN_ARROW.render(graphics, 45, 15);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ package com.drmangotea.tfmg.recipes.jei.machines;
|
||||
import com.drmangotea.tfmg.content.electricity.utilities.polarizer.PolarizerBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.createmod.catnip.gui.element.GuiGameElement;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -23,7 +23,7 @@ public class WindingMachine extends AnimatedKinetics {
|
||||
|
||||
matrixStack.pushPose();
|
||||
matrixStack.translate(xOffset, yOffset, 0.0);
|
||||
if(shadow)
|
||||
if (shadow)
|
||||
AllGuiTextures.JEI_SHADOW.render(graphics, -16, 13);
|
||||
matrixStack.translate(-2.0, 18.0, 0.0);
|
||||
int scale = 22;
|
||||
@@ -32,27 +32,27 @@ public class WindingMachine extends AnimatedKinetics {
|
||||
.scale(scale)
|
||||
.render(graphics);
|
||||
blockElement(AllPartialModels.SHAFT_HALF)
|
||||
.rotateBlock(22.5, 22.5+270, 0.0)
|
||||
.rotateBlock(22.5, 22.5 + 270, 0.0)
|
||||
.scale(scale)
|
||||
.render(graphics);
|
||||
|
||||
|
||||
blockElement(TFMGPartialModels.SPOOL)
|
||||
.rotateBlock(22.5, 22.5, 0)
|
||||
.atLocal(-0.15,-0.4,-0.23)
|
||||
.scale(scale)
|
||||
.render(graphics);
|
||||
blockElement(coil)
|
||||
.rotateBlock(22.5, 22.5, 0)
|
||||
.atLocal(-0.15,-0.4,-0.23)
|
||||
.atLocal(-0.15, -0.4, -0.23)
|
||||
.scale(scale)
|
||||
.render(graphics);
|
||||
if (coil != null)
|
||||
blockElement(coil)
|
||||
.rotateBlock(22.5, 22.5, 0)
|
||||
.atLocal(-0.15, -0.4, -0.23)
|
||||
.scale(scale)
|
||||
.render(graphics);
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void draw(GuiGraphics guiGraphics, int i, int i1) {
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ public class TFMGBlockEntities {
|
||||
.register();
|
||||
public static final BlockEntityEntry<FuseBlockEntity> FUSE_BLOCK = REGISTRATE
|
||||
.blockEntity("fuse_block", FuseBlockEntity::new)
|
||||
.validBlocks(TFMGBlocks.FUSE_BLOCK)
|
||||
// .validBlocks(TFMGBlocks.FUSE_BLOCK)
|
||||
.renderer(() -> FuseBlockRenderer::new)
|
||||
.register();
|
||||
public static final BlockEntityEntry<SegmentedDisplayBlockEntity> SEGMENTED_DISPLAY = REGISTRATE
|
||||
|
||||
@@ -185,7 +185,6 @@ public class TFMGBlocks {
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.addLayer(() -> RenderType::cutoutMipped)
|
||||
.transform(TFMGStress.setCapacity(45.0))
|
||||
.onRegister(connectedTextures(() -> new EngineCTBehavior(TFMGSpriteShifts.REGULAR_ENGINE_TOP, TFMGSpriteShifts.REGULAR_ENGINE_BOTTOM, TFMGSpriteShifts.REGULAR_ENGINE_SIDE)))
|
||||
.blockstate(new TurbineEngineGenerator()::generate)
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
@@ -1258,16 +1257,16 @@ public class TFMGBlocks {
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<FuseBlock> FUSE_BLOCK =
|
||||
REGISTRATE.block("fuse_block", FuseBlock::new)
|
||||
.initialProperties(() -> Blocks.IRON_BLOCK)
|
||||
.transform(pickaxeOnly())
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.addLayer(() -> RenderType::cutoutMipped)
|
||||
.blockstate(BlockStateGen.horizontalBlockProvider(true))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
//public static final BlockEntry<FuseBlock> FUSE_BLOCK =
|
||||
// REGISTRATE.block("fuse_block", FuseBlock::new)
|
||||
// .initialProperties(() -> Blocks.IRON_BLOCK)
|
||||
// .transform(pickaxeOnly())
|
||||
// .properties(BlockBehaviour.Properties::noOcclusion)
|
||||
// .addLayer(() -> RenderType::cutoutMipped)
|
||||
// .blockstate(BlockStateGen.horizontalBlockProvider(true))
|
||||
// .item()
|
||||
// .transform(customItemModel())
|
||||
// .register();
|
||||
|
||||
|
||||
//------------------EXHAUST/WASTE_REMOVAL------------------//
|
||||
|
||||
@@ -4,9 +4,9 @@ import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGArmorMaterials;
|
||||
import com.drmangotea.tfmg.base.TFMGTiers;
|
||||
import com.drmangotea.tfmg.content.decoration.gearbox.SteelVerticalGearboxItem;
|
||||
import com.drmangotea.tfmg.content.electricity.configuration_wrench.ElectriciansWrenchItem;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnection;
|
||||
import com.drmangotea.tfmg.content.electricity.debug.DebugCinderBlockItem;
|
||||
import com.drmangotea.tfmg.content.electricity.configuration_wrench.ElectriciansWrenchItem;
|
||||
import com.drmangotea.tfmg.content.electricity.measurement.MultimeterItem;
|
||||
import com.drmangotea.tfmg.content.electricity.utilities.fuse_block.FuseItem;
|
||||
import com.drmangotea.tfmg.content.electricity.utilities.resistor.ResistorItem;
|
||||
@@ -93,9 +93,9 @@ public class TFMGItems {
|
||||
|
||||
public static final ItemEntry<Item>
|
||||
REBAR = REGISTRATE.item("rebar", Item::new)
|
||||
.tag(AllTags.forgeItemTag("rods/steel"))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.tag(AllTags.forgeItemTag("ingots/steel")), RecipeCategory.BUILDING_BLOCKS, c::get, 4))
|
||||
.register(),
|
||||
.tag(AllTags.forgeItemTag("rods/steel"))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.tag(AllTags.forgeItemTag("ingots/steel")), RecipeCategory.BUILDING_BLOCKS, c::get, 4))
|
||||
.register(),
|
||||
SYNTHETIC_STRING = REGISTRATE.item("synthetic_string", Item::new)
|
||||
.tag(Tags.Items.STRING, AllTags.forgeItemTag("string"))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.tag(AllTags.forgeItemTag("ingots/rubber")), RecipeCategory.MISC, c::get, 4))
|
||||
@@ -117,8 +117,8 @@ public class TFMGItems {
|
||||
FIRECLAY_BALL = REGISTRATE.item("fireclay_ball", Item::new).register(),
|
||||
SCREW = REGISTRATE.item("screw", Item::new)
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.tag(AllTags.forgeItemTag("ingots/steel")), RecipeCategory.BUILDING_BLOCKS, c::get, 4))
|
||||
.lang("Screws")
|
||||
.register(),
|
||||
TURBINE_BLADE = REGISTRATE.item("turbine_blade", Item::new).register(),
|
||||
THERMITE_POWDER = REGISTRATE.item("thermite_powder", Item::new).register(),
|
||||
STEEL_MECHANISM = REGISTRATE.item("steel_mechanism", Item::new).register(),
|
||||
NITRATE_DUST = REGISTRATE.item("nitrate_dust", Item::new).register(),
|
||||
@@ -132,14 +132,14 @@ public class TFMGItems {
|
||||
ETCHED_CIRCUIT_BOARD = REGISTRATE.item("etched_circuit_board", Item::new).register(),
|
||||
CIRCUIT_BOARD = REGISTRATE.item("circuit_board", Item::new).register(),
|
||||
TRANSISTOR = REGISTRATE.item("transistor_item", Item::new).lang("Transistor")
|
||||
.properties(p->p.stacksTo(1)).register(),
|
||||
.properties(p -> p.stacksTo(1)).register(),
|
||||
CAPACITOR = REGISTRATE.item("capacitor_item", Item::new).lang("Capacitor").register(),
|
||||
COPPER_SULFATE = REGISTRATE.item("copper_sulfate", Item::new).register(),
|
||||
LITHIUM_CHARGE = REGISTRATE.item("lithium_charge", Item::new).register(),
|
||||
TURBO = REGISTRATE.item("turbo", Item::new).register(),
|
||||
GOLDEN_TURBO = REGISTRATE.item("golden_turbo", Item::new).register(),
|
||||
CINDERBLOCK = REGISTRATE.item("cinderblock", Item::new)
|
||||
// .recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.CONCRETE.get()), RecipeCategory.BUILDING_BLOCKS, c::get, 4))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.CONCRETE.block.asItem()), RecipeCategory.BUILDING_BLOCKS, c::get, 8))
|
||||
.register(),
|
||||
CINDERFLOURBLOCK = REGISTRATE.item("cinderflourblock", Item::new).register(),
|
||||
NAPALM_POTATO = REGISTRATE.item("napalm_potato", Item::new).register(),
|
||||
@@ -175,12 +175,16 @@ public class TFMGItems {
|
||||
.model((c, p) -> p.withExistingParent(c.getName(), TFMG.asResource("item/glass_insulator_segment_model"))).register();
|
||||
public static final ItemEntry<TransmissionItem>
|
||||
TRANSMISSION = REGISTRATE.item("transmission", TransmissionItem::new)
|
||||
.properties(p -> p.stacksTo(1))
|
||||
.model((c, p) -> p.withExistingParent(c.getName(), TFMG.asResource("item/transmission_model"))).register();
|
||||
|
||||
public static final ItemEntry<ResistorItem>
|
||||
UNFINISHED_RESISTOR = REGISTRATE.item("unfinished_resistor", ResistorItem::new).register();
|
||||
public static final ItemEntry<CylinderItem>
|
||||
ENGINE_CYLINDER = REGISTRATE.item("engine_cylinder", CylinderItem::new).register();
|
||||
DIESEL_ENGINE_CYLINDER = REGISTRATE.item("diesel_engine_cylinder", CylinderItem::new).register(),
|
||||
SIMPLE_ENGINE_CYLINDER = REGISTRATE.item("simple_engine_cylinder", CylinderItem::new).register(),
|
||||
ENGINE_CYLINDER = REGISTRATE.item("engine_cylinder", CylinderItem::new).register(),
|
||||
TURBINE_BLADE = REGISTRATE.item("turbine_blade", CylinderItem::new).register();
|
||||
public static final ItemEntry<SpoolItem>
|
||||
EMPTY_SPOOL = spoolItem("empty", null, 0x000000, CableConnection.CableType.NONE)
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.HARDENED_PLANKS.asItem()), RecipeCategory.BUILDING_BLOCKS, c::get, 1))
|
||||
@@ -196,9 +200,9 @@ public class TFMGItems {
|
||||
REGISTRATE.item("electromagnetic_coil", ElectromagneticCoilItem::new)
|
||||
.properties(p -> p.stacksTo(1))
|
||||
.register();
|
||||
public static final ItemEntry<FuseItem> FUSE = REGISTRATE.item("fuse", FuseItem::new)
|
||||
.properties(p -> p.stacksTo(1))
|
||||
.register();
|
||||
//public static final ItemEntry<FuseItem> FUSE = REGISTRATE.item("fuse", FuseItem::new)
|
||||
// .properties(p -> p.stacksTo(1))
|
||||
// .register();
|
||||
public static final ItemEntry<CoalCokeItem> COAL_COKE_DUST = REGISTRATE.item("coal_coke_dust", CoalCokeItem::new)
|
||||
.tag(forgeItemTag("dusts/coal_coke"), TFMGTags.TFMGItemTags.BLAST_FURNACE_FUEL.tag)
|
||||
.register();
|
||||
@@ -416,7 +420,7 @@ public class TFMGItems {
|
||||
|
||||
for (String color : COLORS) {
|
||||
|
||||
map.put(color,REGISTRATE.item(color + "_multimeter", MultimeterItem::new)
|
||||
map.put(color, REGISTRATE.item(color + "_multimeter", MultimeterItem::new)
|
||||
.register());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.drmangotea.tfmg.registry;
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.recipes.*;
|
||||
import com.simibubi.create.AllTags;
|
||||
import com.simibubi.create.content.equipment.toolbox.ToolboxDyeingRecipe;
|
||||
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeFactory;
|
||||
import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer;
|
||||
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
|
||||
@@ -12,10 +13,7 @@ import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.world.item.crafting.*;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
@@ -35,7 +33,8 @@ DISTILLATION(DistillationRecipe::new),
|
||||
WINDING(WindingRecipe::new),
|
||||
HOT_BLAST(HotBlastRecipe::new),
|
||||
VAT_MACHINE_RECIPE(VatMachineRecipe::new),
|
||||
POLARIZING(PolarizingRecipe::new)
|
||||
POLARIZING(PolarizingRecipe::new),
|
||||
|
||||
;
|
||||
|
||||
private final ResourceLocation id;
|
||||
|
||||
436
src/main/java/com/drmangotea/tfmg/registry/TFMGSoundEvents.java
Normal file
@@ -0,0 +1,436 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.Create;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
public class TFMGSoundEvents {
|
||||
|
||||
public static final Map<ResourceLocation, TFMGSoundEvents.SoundEntry> ALL = new HashMap<>();
|
||||
|
||||
public static final TFMGSoundEvents.SoundEntry
|
||||
|
||||
|
||||
ENGINE = create("engine")
|
||||
.subtitle("Engine Sounds")
|
||||
.category(SoundSource.BLOCKS)
|
||||
.attenuationDistance(10)
|
||||
.build(),
|
||||
|
||||
DIESEL_ENGINE = create("diesel_engine")
|
||||
.subtitle("Diesel Engine Sounds")
|
||||
.category(SoundSource.BLOCKS)
|
||||
.attenuationDistance(10)
|
||||
.build();
|
||||
|
||||
private static SoundEntryBuilder create(String name) {
|
||||
return create(TFMG.asResource(name));
|
||||
}
|
||||
|
||||
public static SoundEntryBuilder create(ResourceLocation id) {
|
||||
return new SoundEntryBuilder(id);
|
||||
}
|
||||
|
||||
public static void prepare() {
|
||||
for (SoundEntry entry : ALL.values())
|
||||
entry.prepare();
|
||||
}
|
||||
|
||||
public static void register(RegisterEvent event) {
|
||||
event.register(Registries.SOUND_EVENT, helper -> {
|
||||
for (SoundEntry entry : ALL.values())
|
||||
entry.register(helper);
|
||||
});
|
||||
}
|
||||
|
||||
public static void provideLang(BiConsumer<String, String> consumer) {
|
||||
for (SoundEntry entry : ALL.values())
|
||||
if (entry.hasSubtitle())
|
||||
consumer.accept(entry.getSubtitleKey(), entry.getSubtitle());
|
||||
}
|
||||
|
||||
public static SoundEntryProvider provider(DataGenerator generator) {
|
||||
return new SoundEntryProvider(generator);
|
||||
}
|
||||
|
||||
public static void playItemPickup(Player player) {
|
||||
player.level()
|
||||
.playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f,
|
||||
1f + player.level().random.nextFloat());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class SoundEntryProvider implements DataProvider {
|
||||
|
||||
private PackOutput output;
|
||||
|
||||
public SoundEntryProvider(DataGenerator generator) {
|
||||
output = generator.getPackOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<?> run(CachedOutput cache) {
|
||||
return generate(output.getOutputFolder(), cache);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "TFMG's Custom Sounds";
|
||||
}
|
||||
|
||||
public CompletableFuture<?> generate(Path path, CachedOutput cache) {
|
||||
path = path.resolve("assets/tfmg");
|
||||
JsonObject json = new JsonObject();
|
||||
ALL.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.forEach(entry -> {
|
||||
entry.getValue()
|
||||
.write(json);
|
||||
});
|
||||
return DataProvider.saveStable(cache, json, path.resolve("sounds.json"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public record ConfiguredSoundEvent(Supplier<SoundEvent> event, float volume, float pitch) {
|
||||
}
|
||||
|
||||
public static class SoundEntryBuilder {
|
||||
|
||||
protected ResourceLocation id;
|
||||
protected String subtitle = "unregistered";
|
||||
protected SoundSource category = SoundSource.BLOCKS;
|
||||
protected List<ConfiguredSoundEvent> wrappedEvents;
|
||||
protected List<ResourceLocation> variants;
|
||||
protected int attenuationDistance;
|
||||
|
||||
public SoundEntryBuilder(ResourceLocation id) {
|
||||
wrappedEvents = new ArrayList<>();
|
||||
variants = new ArrayList<>();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public SoundEntryBuilder subtitle(String subtitle) {
|
||||
this.subtitle = subtitle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEntryBuilder attenuationDistance(int distance) {
|
||||
this.attenuationDistance = distance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEntryBuilder noSubtitle() {
|
||||
this.subtitle = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEntryBuilder category(SoundSource category) {
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEntryBuilder addVariant(String name) {
|
||||
return addVariant(TFMG.asResource(name));
|
||||
}
|
||||
|
||||
public SoundEntryBuilder addVariant(ResourceLocation id) {
|
||||
variants.add(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEntryBuilder playExisting(Supplier<SoundEvent> event, float volume, float pitch) {
|
||||
wrappedEvents.add(new ConfiguredSoundEvent(event, volume, pitch));
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoundEntryBuilder playExisting(SoundEvent event, float volume, float pitch) {
|
||||
return playExisting(() -> event, volume, pitch);
|
||||
}
|
||||
|
||||
public SoundEntryBuilder playExisting(SoundEvent event) {
|
||||
return playExisting(event, 1, 1);
|
||||
}
|
||||
|
||||
public SoundEntryBuilder playExisting(Holder<SoundEvent> event) {
|
||||
return playExisting(event::get, 1, 1);
|
||||
}
|
||||
|
||||
public SoundEntry build() {
|
||||
SoundEntry entry =
|
||||
wrappedEvents.isEmpty() ? new CustomSoundEntry(id, variants, subtitle, category, attenuationDistance)
|
||||
: new WrappedSoundEntry(id, subtitle, wrappedEvents, category, attenuationDistance);
|
||||
ALL.put(entry.getId(), entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static abstract class SoundEntry {
|
||||
|
||||
protected ResourceLocation id;
|
||||
protected String subtitle;
|
||||
protected SoundSource category;
|
||||
protected int attenuationDistance;
|
||||
|
||||
public SoundEntry(ResourceLocation id, String subtitle, SoundSource category, int attenuationDistance) {
|
||||
this.id = id;
|
||||
this.subtitle = subtitle;
|
||||
this.category = category;
|
||||
this.attenuationDistance = attenuationDistance;
|
||||
}
|
||||
|
||||
public abstract void prepare();
|
||||
|
||||
public abstract void register(RegisterEvent.RegisterHelper<SoundEvent> registry);
|
||||
|
||||
public abstract void write(JsonObject json);
|
||||
|
||||
public abstract SoundEvent getMainEvent();
|
||||
|
||||
public String getSubtitleKey() {
|
||||
return id.getNamespace() + ".subtitle." + id.getPath();
|
||||
}
|
||||
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean hasSubtitle() {
|
||||
return subtitle != null;
|
||||
}
|
||||
|
||||
public String getSubtitle() {
|
||||
return subtitle;
|
||||
}
|
||||
|
||||
public void playOnServer(Level world, Vec3i pos) {
|
||||
playOnServer(world, pos, 1, 1);
|
||||
}
|
||||
|
||||
public void playOnServer(Level world, Vec3i pos, float volume, float pitch) {
|
||||
play(world, null, pos, volume, pitch);
|
||||
}
|
||||
|
||||
public void play(Level world, Player entity, Vec3i pos) {
|
||||
play(world, entity, pos, 1, 1);
|
||||
}
|
||||
|
||||
public void playFrom(Entity entity) {
|
||||
playFrom(entity, 1, 1);
|
||||
}
|
||||
|
||||
public void playFrom(Entity entity, float volume, float pitch) {
|
||||
if (!entity.isSilent())
|
||||
play(entity.level(), null, entity.blockPosition(), volume, pitch);
|
||||
}
|
||||
|
||||
public void play(Level world, Player entity, Vec3i pos, float volume, float pitch) {
|
||||
play(world, entity, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, volume, pitch);
|
||||
}
|
||||
|
||||
public void play(Level world, Player entity, Vec3 pos, float volume, float pitch) {
|
||||
play(world, entity, pos.x(), pos.y(), pos.z(), volume, pitch);
|
||||
}
|
||||
|
||||
public abstract void play(Level world, Player entity, double x, double y, double z, float volume, float pitch);
|
||||
|
||||
public void playAt(Level world, Vec3i pos, float volume, float pitch, boolean fade) {
|
||||
playAt(world, pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5, volume, pitch, fade);
|
||||
}
|
||||
|
||||
public void playAt(Level world, Vec3 pos, float volume, float pitch, boolean fade) {
|
||||
playAt(world, pos.x(), pos.y(), pos.z(), volume, pitch, fade);
|
||||
}
|
||||
|
||||
public abstract void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade);
|
||||
|
||||
}
|
||||
|
||||
private static class WrappedSoundEntry extends SoundEntry {
|
||||
|
||||
private List<ConfiguredSoundEvent> wrappedEvents;
|
||||
private List<WrappedSoundEntry.CompiledSoundEvent> compiledEvents;
|
||||
|
||||
public WrappedSoundEntry(ResourceLocation id, String subtitle,
|
||||
List<ConfiguredSoundEvent> wrappedEvents, SoundSource category, int attenuationDistance) {
|
||||
super(id, subtitle, category, attenuationDistance);
|
||||
this.wrappedEvents = wrappedEvents;
|
||||
compiledEvents = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
for (int i = 0; i < wrappedEvents.size(); i++) {
|
||||
ConfiguredSoundEvent wrapped = wrappedEvents.get(i);
|
||||
ResourceLocation location = getIdOf(i);
|
||||
RegistryObject<SoundEvent> event = RegistryObject.create(location, ForgeRegistries.SOUND_EVENTS);
|
||||
compiledEvents.add(new WrappedSoundEntry.CompiledSoundEvent(event, wrapped.volume(), wrapped.pitch()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
|
||||
for (WrappedSoundEntry.CompiledSoundEvent compiledEvent : compiledEvents) {
|
||||
ResourceLocation location = compiledEvent.event().getId();
|
||||
helper.register(location, SoundEvent.createVariableRangeEvent(location));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getMainEvent() {
|
||||
return compiledEvents.get(0)
|
||||
.event().get();
|
||||
}
|
||||
|
||||
protected ResourceLocation getIdOf(int i) {
|
||||
return new ResourceLocation(id.getNamespace(), i == 0 ? id.getPath() : id.getPath() + "_compounded_" + i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JsonObject json) {
|
||||
for (int i = 0; i < wrappedEvents.size(); i++) {
|
||||
ConfiguredSoundEvent event = wrappedEvents.get(i);
|
||||
JsonObject entry = new JsonObject();
|
||||
JsonArray list = new JsonArray();
|
||||
JsonObject s = new JsonObject();
|
||||
s.addProperty("name", event.event()
|
||||
.get()
|
||||
.getLocation()
|
||||
.toString());
|
||||
s.addProperty("type", "event");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
entry.add("sounds", list);
|
||||
if (i == 0 && hasSubtitle())
|
||||
entry.addProperty("subtitle", getSubtitleKey());
|
||||
json.add(getIdOf(i).getPath(), entry);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void play(Level world, Player entity, double x, double y, double z, float volume, float pitch) {
|
||||
for (WrappedSoundEntry.CompiledSoundEvent event : compiledEvents) {
|
||||
world.playSound(entity, x, y, z, event.event().get(), category, event.volume() * volume,
|
||||
event.pitch() * pitch);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) {
|
||||
for (WrappedSoundEntry.CompiledSoundEvent event : compiledEvents) {
|
||||
world.playLocalSound(x, y, z, event.event().get(), category, event.volume() * volume,
|
||||
event.pitch() * pitch, fade);
|
||||
}
|
||||
}
|
||||
|
||||
private record CompiledSoundEvent(RegistryObject<SoundEvent> event, float volume, float pitch) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class CustomSoundEntry extends SoundEntry {
|
||||
|
||||
protected List<ResourceLocation> variants;
|
||||
protected RegistryObject<SoundEvent> event;
|
||||
|
||||
public CustomSoundEntry(ResourceLocation id, List<ResourceLocation> variants, String subtitle,
|
||||
SoundSource category, int attenuationDistance) {
|
||||
super(id, subtitle, category, attenuationDistance);
|
||||
this.variants = variants;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
event = RegistryObject.create(id, ForgeRegistries.SOUND_EVENTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
|
||||
ResourceLocation location = event.getId();
|
||||
helper.register(location, SoundEvent.createVariableRangeEvent(location));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getMainEvent() {
|
||||
return event.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JsonObject json) {
|
||||
JsonObject entry = new JsonObject();
|
||||
JsonArray list = new JsonArray();
|
||||
|
||||
JsonObject s = new JsonObject();
|
||||
s.addProperty("name", id.toString());
|
||||
s.addProperty("type", "file");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
|
||||
for (ResourceLocation variant : variants) {
|
||||
s = new JsonObject();
|
||||
s.addProperty("name", variant.toString());
|
||||
s.addProperty("type", "file");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
}
|
||||
|
||||
entry.add("sounds", list);
|
||||
if (hasSubtitle())
|
||||
entry.addProperty("subtitle", getSubtitleKey());
|
||||
json.add(id.getPath(), entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void play(Level world, Player entity, double x, double y, double z, float volume, float pitch) {
|
||||
world.playSound(entity, x, y, z, event.get(), category, volume, pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) {
|
||||
world.playLocalSound(x, y, z, event.get(), category, volume, pitch, fade);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import static com.drmangotea.tfmg.registry.TFMGTags.NameSpace.FORGE;
|
||||
import static com.drmangotea.tfmg.registry.TFMGTags.NameSpace.MOD;
|
||||
|
||||
|
||||
@@ -136,8 +137,9 @@ public class TFMGTags {
|
||||
FLUX,
|
||||
SPOOLS,
|
||||
BLAST_FURNACE_FUEL,
|
||||
RODS
|
||||
|
||||
RODS,
|
||||
IRON_PLATES(FORGE, "plates/iron"),
|
||||
ALUMINUM_PLATES(FORGE, "plates/aluminum")
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -62,7 +62,33 @@
|
||||
|
||||
"create.goggles.voltmeter": "Voltmeter:",
|
||||
"create.goggles.gauge.value": " Measured Voltage:",
|
||||
"create.goggles.voltmeter.range": " Measuring Range: %1$s",
|
||||
"create.goggles.voltmeter.range": " Range: %1$s",
|
||||
|
||||
"create.goggles.engine.header": "Engine Info",
|
||||
"create.goggles.engine.type": " Type: ",
|
||||
"create.goggles.engine.rpm": " Speed: ",
|
||||
"create.goggles.engine.signal": " Signal: ",
|
||||
"create.goggles.engine.torque": " Torque:",
|
||||
"create.goggles.engine.fuel_consumption": " Fuel Consumption:",
|
||||
"create.goggles.engine.oil": "Oil: ",
|
||||
"create.goggles.engine.cooling_fluid": "Cooling Fluid: ",
|
||||
"create.goggles.engine.unfinished": "Engine Unfinished",
|
||||
"create.goggles.engine.next_component": " Next Component: ",
|
||||
"create.goggles.engine.pistons_missing": "Pistons Missing",
|
||||
"create.goggles.engine.turbines_missing": "Turbines Missing",
|
||||
|
||||
"create.goggles.vat.header": "Chemical Vat",
|
||||
"create.goggles.vat.attachments": "Attachments:",
|
||||
"create.goggles.vat.contents": "Vat Contents:",
|
||||
"create.goggles.vat.heat_status": "Heat Status: ",
|
||||
"create.goggles.vat.no_heat": "No Heat",
|
||||
"create.goggles.vat.heated": "Heated",
|
||||
"create.goggles.vat.superheated": "Superheated",
|
||||
"create.goggles.vat.tfmg.graphite_electrode": " Graphite Electrode",
|
||||
"create.goggles.vat.tfmg.electrode": " Electrode",
|
||||
"create.goggles.vat.tfmg.mixer": " Mixer",
|
||||
"create.goggles.vat.tfmg.centrifuge": " Centrifuge",
|
||||
|
||||
|
||||
"create.goggles.ammeter": "Ammeter:",
|
||||
"create.goggles.ammeter.amps": " Measured Amps: %1$s V",
|
||||
@@ -87,6 +113,7 @@
|
||||
"create.tooltip.resistor": "Resistance: %1$s",
|
||||
"create.tooltip.coils": "Turns: %1$s",
|
||||
"create.tooltip.cylinder": "Supported Fuels:",
|
||||
"create.tooltip.fluid_item": "Fluid Amount: %1$s",
|
||||
|
||||
"create.recipe.distillation": "Distillation",
|
||||
"create.recipe.advanced_distillation": "Advanced Distillation",
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
"texture_size": [32, 32],
|
||||
"textures": {
|
||||
"1": "tfmg:block/converter",
|
||||
"2": "tfmg:block/heavy_machinery_casing",
|
||||
"particle": "tfmg:block/heavy_machinery_casing"
|
||||
"2": "tfmg:block/heavy_machinery_casing"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "create:block/copper_casing",
|
||||
"particle": "create:block/copper_casing"
|
||||
"0": "tfmg:block/copper_encased_aluminum_pipe_side",
|
||||
"particle": "tfmg:block/copper_encased_aluminum_pipe_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "create:block/copper_casing",
|
||||
"particle": "create:block/copper_casing"
|
||||
"0": "tfmg:block/copper_encased_brass_pipe_side",
|
||||
"particle": "tfmg:block/copper_encased_brass_pipe_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "create:block/copper_casing",
|
||||
"particle": "create:block/copper_casing"
|
||||
"0": "tfmg:block/copper_encased_cast_iron_pipe_side",
|
||||
"particle": "tfmg:block/copper_encased_cast_iron_pipe_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "create:block/copper_casing",
|
||||
"particle": "create:block/copper_casing"
|
||||
"0": "tfmg:block/copper_encased_plastic_pipe_side",
|
||||
"particle": "tfmg:block/copper_encased_plastic_pipe_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "create:block/copper_casing",
|
||||
"particle": "create:block/copper_casing"
|
||||
"0": "tfmg:block/copper_encased_steel_pipe_side",
|
||||
"particle": "tfmg:block/copper_encased_steel_pipe_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "tfmg:block/industrial_aluminum_casing",
|
||||
"1": "tfmg:block/aluminum_inlet",
|
||||
"2": "tfmg:block/electrode_holder_slot",
|
||||
"3": "tfmg:block/heavy_machinery_casing",
|
||||
"particle": "tfmg:block/industrial_aluminum_casing"
|
||||
},
|
||||
"elements": [
|
||||
@@ -12,10 +12,10 @@
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#3"},
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#3"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#3"},
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#3"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "tfmg:block/industrial_aluminum_casing",
|
||||
"1": "tfmg:block/aluminum_inlet",
|
||||
"2": "tfmg:block/electrode_holder_slot",
|
||||
"3": "tfmg:block/heavy_machinery_casing",
|
||||
"particle": "tfmg:block/industrial_aluminum_casing"
|
||||
},
|
||||
"elements": [
|
||||
@@ -12,10 +12,10 @@
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#3"},
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#3"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#3"},
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#3"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 418 B |
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 418 B |
|
After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 435 B |
|
After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 674 B After Width: | Height: | Size: 391 B |
|
After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 401 B |
|
After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 493 B After Width: | Height: | Size: 493 B |
|
Before Width: | Height: | Size: 755 B After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 259 B |
25
src/main/resources/data/tfmg/recipes/engine_cylinder.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"key": {
|
||||
"P": {
|
||||
"tag": "forge:plates/aluminum"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
" ",
|
||||
"P P",
|
||||
"P P"
|
||||
],
|
||||
"result": {
|
||||
"item": "tfmg:diesel_engine_cylinder",
|
||||
"nbt": {
|
||||
"Fuels": {
|
||||
"gasoline": "forge:diesel"
|
||||
},
|
||||
"FuelNames": {
|
||||
"gasoline": "Diesel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"key": {
|
||||
"P": {
|
||||
"tag": "forge:plates/iron"
|
||||
},
|
||||
"F": {
|
||||
"item": "minecraft:flint_and_steel"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
" F ",
|
||||
"P P",
|
||||
"P P"
|
||||
],
|
||||
"result": {
|
||||
"item": "tfmg:simple_engine_cylinder",
|
||||
"nbt": {
|
||||
"Fuels": {
|
||||
"furnace_gas": "forge:furnace_gas",
|
||||
"creosote": "forge:creosote"
|
||||
},
|
||||
"FuelNames": {
|
||||
"furnace_gas": "Furnace Gas",
|
||||
"creosote": "Creosote"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"key": {
|
||||
"C": {
|
||||
"item": "tfmg:engine_cylinder",
|
||||
"nbt": {
|
||||
"Fuels": {
|
||||
"gasoline": "forge:gasoline",
|
||||
"naphtha": "forge:naphtha",
|
||||
"kerosene": "forge:kerosene"
|
||||
},
|
||||
"FuelNames": {
|
||||
"gasoline": "Gasoline",
|
||||
"naphtha": "Naphtha",
|
||||
"kerosene": "Kerosene"
|
||||
}
|
||||
}
|
||||
},
|
||||
"B": {
|
||||
"item": "tfmg:brass_pipe"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
" ",
|
||||
" C ",
|
||||
" B "
|
||||
],
|
||||
"result": {
|
||||
"item": "tfmg:engine_cylinder",
|
||||
"nbt": {
|
||||
"Fuels": {
|
||||
"lpg": "forge:lpg"
|
||||
},
|
||||
"FuelNames": {
|
||||
"lpg": "LPG"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"key": {
|
||||
"C": {
|
||||
"item": "tfmg:diesel_engine_cylinder",
|
||||
"nbt": {
|
||||
"Fuels": {
|
||||
"gasoline": "forge:diesel"
|
||||
},
|
||||
"FuelNames": {
|
||||
"gasoline": "Diesel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"S": {
|
||||
"item": "tfmg:spark_plug"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
" S ",
|
||||
" C ",
|
||||
" "
|
||||
],
|
||||
"result": {
|
||||
"item": "tfmg:engine_cylinder",
|
||||
"nbt": {
|
||||
"Fuels": {
|
||||
"gasoline": "forge:gasoline",
|
||||
"naphtha": "forge:naphtha",
|
||||
"kerosene": "forge:kerosene"
|
||||
},
|
||||
"FuelNames": {
|
||||
"gasoline": "Gasoline",
|
||||
"naphtha": "Naphtha",
|
||||
"kerosene": "Kerosene"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
src/main/resources/data/tfmg/recipes/turbine_blade.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"key": {
|
||||
"S": {
|
||||
"item": "create:shaft"
|
||||
},
|
||||
"I": {
|
||||
"tag": "forge:plates/iron"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
"III",
|
||||
"ISI",
|
||||
"III"
|
||||
],
|
||||
"result": {
|
||||
"item": "tfmg:turbine_blade",
|
||||
"nbt": {
|
||||
"Fuels": {
|
||||
"kerosene": "forge:kerosene"
|
||||
},
|
||||
"FuelNames": {
|
||||
"kerosene": "Kerosene"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||