formworks
This commit is contained in:
@@ -36,6 +36,7 @@ public class CreateTFMG
|
||||
|
||||
TFMGBlocks.register();
|
||||
TFMGItems.register();
|
||||
TFMGBlockEntities.register();
|
||||
TFMGEntityTypes.register();
|
||||
TFMGCreativeModeTabs.init();
|
||||
TFMGFluids.register();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drmangotea.tfmg;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
@@ -10,7 +11,7 @@ public class CreateTFMGClient {
|
||||
|
||||
public CreateTFMGClient() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
//CIPartialModels.init();
|
||||
TFMGPartialModels.init();
|
||||
modEventBus.register(this);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.drmangotea.tfmg.base;
|
||||
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkBlock;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkBlockEntity;
|
||||
import com.simibubi.create.AllTags;
|
||||
import com.simibubi.create.content.contraptions.behaviour.DoorMovingInteraction;
|
||||
import com.simibubi.create.content.decoration.slidingDoor.SlidingDoorBlock;
|
||||
import com.simibubi.create.content.decoration.slidingDoor.SlidingDoorMovementBehaviour;
|
||||
import com.simibubi.create.foundation.data.AssetLookup;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.data.loot.BlockLoot;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
|
||||
import static com.simibubi.create.AllInteractionBehaviours.interactionBehaviour;
|
||||
import static com.simibubi.create.AllMovementBehaviours.movementBehaviour;
|
||||
import static com.simibubi.create.foundation.data.TagGen.axeOnly;
|
||||
|
||||
|
||||
public class TFMGBuilderTransformers {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.drmangotea.tfmg.content.concrete.formwork;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class FormWorkBlock extends Block implements IWrenchable, IBE<FormWorkBlockEntity> {
|
||||
public FormWorkBlock(Properties p_49795_) {
|
||||
super(p_49795_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FormWorkBlockEntity> getBlockEntityClass() {
|
||||
return FormWorkBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends FormWorkBlockEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.FORMWORK.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
package com.drmangotea.tfmg.content.concrete.formwork;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.content.machines.TFMGMachineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
|
||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
|
||||
|
||||
public boolean east = true;
|
||||
public boolean west = true;
|
||||
public boolean north = true;
|
||||
public boolean south = true;
|
||||
public boolean bottom = true;
|
||||
|
||||
protected FluidTank tankInventory;
|
||||
|
||||
|
||||
public LerpedFloat fluidLevel = LerpedFloat.linear();
|
||||
public FormWorkBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
tankInventory = createInventory();
|
||||
fluidCapability = LazyOptional.of(() -> tankInventory);
|
||||
tank1.forbidInsertion();
|
||||
tank2.forbidExtraction();
|
||||
}
|
||||
protected SmartFluidTank createInventory() {
|
||||
return new SmartFluidTank(1000, this::onFluidStackChanged){
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(TFMGFluids.LIQUID_CONCRETE.getSource());
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(FluidStack resource, FluidAction action) {
|
||||
return FluidStack.EMPTY;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
fluidLevel.chase(tankInventory.getFluidAmount(), 0.3f, LerpedFloat.Chaser.EXP);
|
||||
fluidLevel.tickChaser();
|
||||
|
||||
BlockEntity blockEntityBelow = level.getBlockEntity(this.getBlockPos().below());
|
||||
BlockEntity blockEntityNorth = level.getBlockEntity(this.getBlockPos().north());
|
||||
BlockEntity blockEntityWest = level.getBlockEntity(this.getBlockPos().west());
|
||||
BlockEntity blockEntityEast = level.getBlockEntity(this.getBlockPos().east());
|
||||
BlockEntity blockEntitySouth = level.getBlockEntity(this.getBlockPos().south());
|
||||
|
||||
|
||||
bottom = !(blockEntityBelow instanceof FormWorkBlockEntity);
|
||||
east = !(blockEntityEast instanceof FormWorkBlockEntity);
|
||||
west = !(blockEntityWest instanceof FormWorkBlockEntity);
|
||||
north = !(blockEntityNorth instanceof FormWorkBlockEntity);
|
||||
south = !(blockEntitySouth instanceof FormWorkBlockEntity);
|
||||
for (int x = 0; x < 30; x++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
BlockEntity CheckedBE = null;
|
||||
|
||||
if (i == 0) {
|
||||
CheckedBE = level.getBlockEntity(this.getBlockPos().below());
|
||||
}
|
||||
if (i == 1) {
|
||||
CheckedBE = level.getBlockEntity(this.getBlockPos().east());
|
||||
}
|
||||
if (i == 2) {
|
||||
CheckedBE = level.getBlockEntity(this.getBlockPos().west());
|
||||
}
|
||||
if (i == 3) {
|
||||
CheckedBE = level.getBlockEntity(this.getBlockPos().north());
|
||||
}
|
||||
if (i == 4) {
|
||||
CheckedBE = level.getBlockEntity(this.getBlockPos().south());
|
||||
}
|
||||
|
||||
if (CheckedBE instanceof FormWorkBlockEntity) {
|
||||
if(((FormWorkBlockEntity) CheckedBE).tankInventory.getFluidAmount()>this.tankInventory.getFluidAmount()&&i!=0)
|
||||
continue;
|
||||
|
||||
FluidTank checkedTank = ((FormWorkBlockEntity) CheckedBE).tankInventory;
|
||||
if (checkedTank.getFluidAmount() < 1000) {
|
||||
if(checkedTank.getFluidAmount()>=995&&tankInventory.getFluidAmount()>0){
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.getSource(), checkedTank.getFluidAmount()+1));
|
||||
//tankInventory.drain(1, IFluidHandler.FluidAction.EXECUTE);
|
||||
// continue;
|
||||
}
|
||||
|
||||
int reducedAmount = tankInventory.getFluidAmount() / 8;
|
||||
|
||||
if (tankInventory.getFluidAmount() != 0)
|
||||
reducedAmount = 1;
|
||||
int newFluidAmount = checkedTank.getFluidAmount() + reducedAmount;
|
||||
|
||||
int toRemove = reducedAmount;
|
||||
//if full
|
||||
if (newFluidAmount > 1000) {
|
||||
continue;
|
||||
// int amountModifier = newFluidAmount - 1000;
|
||||
// newFluidAmount -= amountModifier;
|
||||
// toRemove = reducedAmount - amountModifier;
|
||||
}
|
||||
//
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.getSource(), newFluidAmount));
|
||||
tankInventory.drain(1, IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
BlockPos below = this.getBlockPos().below();
|
||||
|
||||
BlockPos west = this.getBlockPos().west();
|
||||
BlockPos east = this.getBlockPos().east();
|
||||
BlockPos north = this.getBlockPos().north();
|
||||
BlockPos south = this.getBlockPos().south();
|
||||
|
||||
if(level.getBlockEntity(below) instanceof FormWorkBlockEntity){
|
||||
bottom = false;
|
||||
}else bottom = true;
|
||||
if(level.getBlockEntity(west) instanceof FormWorkBlockEntity){
|
||||
bottom = false;
|
||||
}else bottom = true;
|
||||
if(level.getBlockEntity(east) instanceof FormWorkBlockEntity){
|
||||
bottom = false;
|
||||
}else bottom = true;
|
||||
if(level.getBlockEntity(north) instanceof FormWorkBlockEntity){
|
||||
bottom = false;
|
||||
}else bottom = true;
|
||||
if(level.getBlockEntity(south) instanceof FormWorkBlockEntity){
|
||||
bottom = false;
|
||||
}else bottom = true;
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
protected void onFluidStackChanged(FluidStack newFluidStack) {
|
||||
if (!hasLevel())
|
||||
return;
|
||||
|
||||
|
||||
|
||||
if (!level.isClientSide) {
|
||||
setChanged();
|
||||
sendData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public float getFillState() {
|
||||
return (float) tankInventory.getFluidAmount() / tankInventory.getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
bottom = compound.getBoolean("Bottom");
|
||||
|
||||
east = compound.getBoolean("East");
|
||||
west = compound.getBoolean("West");
|
||||
north = compound.getBoolean("North");
|
||||
south = compound.getBoolean("South");
|
||||
tankInventory.readFromNBT(compound.getCompound("TankContent"));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
super.write(compound, clientPacket);
|
||||
|
||||
|
||||
compound.putBoolean("Bottom", bottom);
|
||||
|
||||
compound.putBoolean("East", east);
|
||||
compound.putBoolean("West", west);
|
||||
compound.putBoolean("North", north);
|
||||
compound.putBoolean("South", south);
|
||||
compound.put("TankContent", tankInventory.writeToNBT(new CompoundTag()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public LerpedFloat getFluidLevel() {
|
||||
return fluidLevel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.drmangotea.tfmg.content.concrete.formwork;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.logistics.chute.ChuteBlock;
|
||||
import com.simibubi.create.content.redstone.thresholdSwitch.ThresholdSwitchBlock;
|
||||
import com.simibubi.create.foundation.data.AssetLookup;
|
||||
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
|
||||
public class FormWorkGenerator extends SpecialBlockStateGen {
|
||||
|
||||
@Override
|
||||
protected int getXRotation(BlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYRotation(BlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Block> ModelFile getModel(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov,
|
||||
BlockState state) {
|
||||
|
||||
|
||||
|
||||
return AssetLookup.partialBaseModel(ctx, prov, "base");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.drmangotea.tfmg.content.concrete.formwork;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
public class FormWorkRenderer extends SafeBlockEntityRenderer<FormWorkBlockEntity> {
|
||||
|
||||
public FormWorkRenderer(BlockEntityRendererProvider.Context context) {}
|
||||
|
||||
@Override
|
||||
protected void renderSafe(FormWorkBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
renderConcreteInside(be,partialTicks,ms,buffer,light,overlay);
|
||||
|
||||
BlockState blockState = be.getBlockState();
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
ms.pushPose();
|
||||
TransformStack msr = TransformStack.cast(ms);
|
||||
msr.translate(1 / 2f, 0.5, 1 / 2f);
|
||||
|
||||
if(be.north) {
|
||||
CachedBufferer.partial(TFMGPartialModels.FORMWORK_SIDE, blockState)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
if(be.east) {
|
||||
CachedBufferer.partial(TFMGPartialModels.FORMWORK_SIDE, blockState)
|
||||
.rotateY(270)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
if(be.south) {
|
||||
CachedBufferer.partial(TFMGPartialModels.FORMWORK_SIDE, blockState)
|
||||
.rotateY(180)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
if(be.west) {
|
||||
CachedBufferer.partial(TFMGPartialModels.FORMWORK_SIDE, blockState)
|
||||
.rotateY(90)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
///
|
||||
if(be.bottom) {
|
||||
CachedBufferer.partial(TFMGPartialModels.FORMWORK_BOTTOM, blockState)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
}
|
||||
|
||||
|
||||
ms.popPose();
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void renderConcreteInside(FormWorkBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
LerpedFloat fluidLevel = be.getFluidLevel();
|
||||
|
||||
if (fluidLevel == null) {
|
||||
return;
|
||||
}
|
||||
float level = fluidLevel.getValue(partialTicks);
|
||||
|
||||
float capHeight = 1 / 4f;
|
||||
float tankHullWidth = 1 / 16f + 1 / 128f;
|
||||
float minPuddleHeight = 1 / 16f;
|
||||
|
||||
|
||||
// float level = fluidLevel.getValue(partialTicks);
|
||||
// if (level < 1 / (512f * 1))
|
||||
// return;
|
||||
// float clampedLevel = Mth.clamp(level * 1, 0, 1);
|
||||
|
||||
FluidTank tank = be.tankInventory;
|
||||
FluidStack fluidStack = tank.getFluid();
|
||||
|
||||
if (fluidStack.isEmpty())
|
||||
return;
|
||||
|
||||
|
||||
|
||||
if(be.getLevel().getBlockEntity(be.getBlockPos().below())instanceof FormWorkBlockEntity){
|
||||
if(((FormWorkBlockEntity) be.getLevel().getBlockEntity(be.getBlockPos().below())).tankInventory.getFluidAmount()<1000){
|
||||
be.fluidLevel.setValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
ms.pushPose();
|
||||
// ms.translate(0, clampedLevel - 1, 0);
|
||||
FluidRenderer.renderFluidBox(fluidStack, 0, 0, 0, 1, be.getFluidLevel().getValue(partialTicks)/1000, 1, buffer, ms, light, false);
|
||||
ms.popPose();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderOffScreen(FormWorkBlockEntity te) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.drmangotea.tfmg.content.machines;
|
||||
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour;
|
||||
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.LangBuilder;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class TFMGMachineBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {
|
||||
public SmartFluidTankBehaviour tank1;
|
||||
public SmartFluidTankBehaviour tank2;
|
||||
|
||||
private boolean contentsChanged;
|
||||
|
||||
protected LazyOptional<IFluidHandler> fluidCapability;
|
||||
|
||||
public TFMGMachineBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
tank1.forbidExtraction();
|
||||
tank2.forbidInsertion();
|
||||
|
||||
contentsChanged = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
tank1 = new SmartFluidTankBehaviour(SmartFluidTankBehaviour.INPUT, this, 1, 1000, true)
|
||||
.whenFluidUpdates(() -> contentsChanged = true);
|
||||
|
||||
tank2 = new SmartFluidTankBehaviour(SmartFluidTankBehaviour.OUTPUT, this, 1, 1000, true)
|
||||
.whenFluidUpdates(() -> contentsChanged = true)
|
||||
.forbidInsertion();
|
||||
behaviours.add(tank1);
|
||||
behaviours.add(tank1);
|
||||
|
||||
fluidCapability = LazyOptional.of(() -> {
|
||||
LazyOptional<? extends IFluidHandler> inputCap = tank1.getCapability();
|
||||
LazyOptional<? extends IFluidHandler> outputCap = tank2.getCapability();
|
||||
return new CombinedTankWrapper(outputCap.orElse(null), inputCap.orElse(null));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
fluidCapability.invalidate();
|
||||
}
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
@Override
|
||||
public void notifyUpdate() {
|
||||
super.notifyUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
|
||||
|
||||
//--Fluid Info--//
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
|
||||
IFluidHandler tank = resolve.get();
|
||||
if (tank.getTanks() == 0)
|
||||
return false;
|
||||
|
||||
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
|
||||
|
||||
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < tank.getTanks(); i++) {
|
||||
FluidStack fluidStack = tank.getFluidInTank(i);
|
||||
if (fluidStack.isEmpty())
|
||||
continue;
|
||||
|
||||
Lang.fluidName(fluidStack)
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.builder()
|
||||
.add(Lang.number(fluidStack.getAmount())
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GREEN))
|
||||
.text(ChatFormatting.GRAY, " / ")
|
||||
.add(Lang.number(tank.getTankCapacity(i))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GRAY))
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
if (tank.getTanks() > 1) {
|
||||
if (isEmpty)
|
||||
tooltip.remove(tooltip.size() - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isEmpty)
|
||||
return true;
|
||||
|
||||
Lang.translate("gui.goggles.fluid_container.capacity")
|
||||
.add(Lang.number(tank.getTankCapacity(0))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GREEN))
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,35 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkBlockEntity;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkRenderer;
|
||||
import com.simibubi.create.content.fluids.pipes.FluidPipeBlockEntity;
|
||||
import com.simibubi.create.content.fluids.pipes.StraightPipeBlockEntity;
|
||||
import com.simibubi.create.content.fluids.pipes.TransparentStraightPipeRenderer;
|
||||
import com.simibubi.create.content.fluids.pump.PumpBlockEntity;
|
||||
import com.simibubi.create.content.fluids.pump.PumpCogInstance;
|
||||
import com.simibubi.create.content.fluids.pump.PumpRenderer;
|
||||
import com.simibubi.create.content.kinetics.base.HalfShaftInstance;
|
||||
import com.simibubi.create.content.kinetics.base.HorizontalHalfShaftInstance;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.SimpleKineticBlockEntity;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.tterrag.registrate.util.entry.BlockEntityEntry;
|
||||
|
||||
import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
|
||||
|
||||
|
||||
public class TFMGBlockEntities {
|
||||
|
||||
|
||||
|
||||
public static final BlockEntityEntry<FormWorkBlockEntity> FORMWORK = REGISTRATE
|
||||
.blockEntity("formwork", FormWorkBlockEntity::new)
|
||||
.renderer(() -> FormWorkRenderer::new)
|
||||
.validBlocks(TFMGBlocks.FORMWORK_BLOCK)
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
public static void register() {}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
public class TFMGBlockStateGen {
|
||||
|
||||
|
||||
public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> nothingLol(
|
||||
String path) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,21 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGBuilderTransformers;
|
||||
import com.drmangotea.tfmg.base.TFMGSpriteShifts;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkBlock;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkGenerator;
|
||||
import com.drmangotea.tfmg.content.gadgets.explosives.napalm.NapalmBombBlock;
|
||||
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire.BlueFireBlock;
|
||||
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire.GreenFireBlock;
|
||||
import com.simibubi.create.AllCreativeModeTabs;
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.decoration.encasing.CasingBlock;
|
||||
import com.simibubi.create.content.decoration.encasing.EncasedCTBehaviour;
|
||||
import com.simibubi.create.content.logistics.chute.ChuteGenerator;
|
||||
import com.simibubi.create.foundation.data.BuilderTransformers;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
||||
@@ -23,8 +24,7 @@ import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
|
||||
import static com.simibubi.create.foundation.data.BlockStateGen.simpleCubeAll;
|
||||
import static com.simibubi.create.foundation.data.CreateRegistrate.casingConnectivity;
|
||||
import static com.simibubi.create.foundation.data.CreateRegistrate.connectedTextures;
|
||||
import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly;
|
||||
import static com.simibubi.create.foundation.data.TagGen.tagBlockAndItem;
|
||||
import static com.simibubi.create.foundation.data.TagGen.*;
|
||||
|
||||
|
||||
public class TFMGBlocks {
|
||||
@@ -60,7 +60,17 @@ public class TFMGBlocks {
|
||||
|
||||
|
||||
//-----------------------MACHINES---------------------------//
|
||||
|
||||
public static final BlockEntry<FormWorkBlock> FORMWORK_BLOCK =
|
||||
REGISTRATE.block("formwork_block", FormWorkBlock::new)
|
||||
.initialProperties(Material.WOOD)
|
||||
.properties(p -> p.color(MaterialColor.WOOD))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.blockstate(new FormWorkGenerator()::generate)
|
||||
.transform(axeOnly())
|
||||
.item()
|
||||
.build()
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.simibubi.create.content.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class TFMGPartialModels {
|
||||
|
||||
public static final PartialModel
|
||||
FORMWORK_BOTTOM = block("formwork_block/block_bottom"),
|
||||
FORMWORK_SIDE = block("formwork_block/block_side");
|
||||
|
||||
public static final Map<ResourceLocation, Couple<PartialModel>> FOLDING_DOORS = new HashMap<>();
|
||||
|
||||
public static final Map<FluidTransportBehaviour.AttachmentTypes.ComponentPartials, Map<Direction, PartialModel>> STEEL_PIPE_ATTACHMENTS =
|
||||
new EnumMap<>(FluidTransportBehaviour.AttachmentTypes.ComponentPartials.class);
|
||||
|
||||
|
||||
static {
|
||||
for (FluidTransportBehaviour.AttachmentTypes.ComponentPartials type : FluidTransportBehaviour.AttachmentTypes.ComponentPartials.values()) {
|
||||
Map<Direction, PartialModel> map = new HashMap<>();
|
||||
for (Direction d : Iterate.directions) {
|
||||
String asId = Lang.asId(type.name());
|
||||
map.put(d, block("steel_fluid_pipe/" + asId + "/" + Lang.asId(d.getSerializedName())));
|
||||
}
|
||||
STEEL_PIPE_ATTACHMENTS.put(type, map);
|
||||
}
|
||||
|
||||
putFoldingDoor("steel_door");
|
||||
|
||||
|
||||
}
|
||||
private static void putFoldingDoor(String path) {
|
||||
FOLDING_DOORS.put(CreateTFMG.asResource(path),
|
||||
Couple.create(block(path + "/fold_left"), block(path + "/fold_right")));
|
||||
}
|
||||
private static PartialModel block(String path) {
|
||||
return new PartialModel(CreateTFMG.asResource("block/" + path));
|
||||
}
|
||||
|
||||
public static void init() {}
|
||||
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
|
||||
import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.simibubi.create.foundation.data.BlockStateGen;
|
||||
import com.simibubi.create.foundation.data.CreateBlockEntityBuilder;
|
||||
import com.simibubi.create.foundation.data.CreateEntityBuilder;
|
||||
import com.simibubi.create.foundation.data.VirtualFluidBuilder;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.decoration.encasing.CasingConnectivity;
|
||||
import com.simibubi.create.content.fluids.VirtualFluid;
|
||||
import com.simibubi.create.foundation.block.connected.CTModel;
|
||||
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
|
||||
import com.simibubi.create.foundation.item.TooltipModifier;
|
||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||
import com.tterrag.registrate.AbstractRegistrate;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.builders.BlockEntityBuilder.BlockEntityFactory;
|
||||
import com.tterrag.registrate.builders.Builder;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
import com.tterrag.registrate.util.nullness.NonNullConsumer;
|
||||
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
public class TFMGRegistrate extends AbstractRegistrate<TFMGRegistrate> {
|
||||
@Nullable
|
||||
protected Function<Item, TooltipModifier> currentTooltipModifierFactory;
|
||||
|
||||
protected TFMGRegistrate(String modid) {
|
||||
super(modid);
|
||||
}
|
||||
|
||||
public static TFMGRegistrate create(String modid) {
|
||||
return new TFMGRegistrate(modid);
|
||||
}
|
||||
|
||||
public TFMGRegistrate setTooltipModifierFactory(@Nullable Function<Item, TooltipModifier> factory) {
|
||||
currentTooltipModifierFactory = factory;
|
||||
return self();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Function<Item, TooltipModifier> getTooltipModifierFactory() {
|
||||
return currentTooltipModifierFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TFMGRegistrate registerEventListeners(IEventBus bus) {
|
||||
return super.registerEventListeners(bus);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <R, T extends R> RegistryEntry<T> accept(String name, ResourceKey<? extends Registry<R>> type,
|
||||
Builder<R, T, ?, ?> builder, NonNullSupplier<? extends T> creator,
|
||||
NonNullFunction<RegistryObject<T>, ? extends RegistryEntry<T>> entryFactory) {
|
||||
RegistryEntry<T> entry = super.accept(name, type, builder, creator, entryFactory);
|
||||
if (type.equals(Registry.ITEM_REGISTRY)) {
|
||||
if (currentTooltipModifierFactory != null) {
|
||||
TooltipModifier.REGISTRY.registerDeferred(entry.getId(), currentTooltipModifierFactory);
|
||||
}
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockEntity> CreateBlockEntityBuilder<T, TFMGRegistrate> blockEntity(String name,
|
||||
BlockEntityFactory<T> factory) {
|
||||
return blockEntity(self(), name, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockEntity, P> CreateBlockEntityBuilder<T, P> blockEntity(P parent, String name,
|
||||
BlockEntityFactory<T> factory) {
|
||||
return (CreateBlockEntityBuilder<T, P>) entry(name,
|
||||
(callback) -> CreateBlockEntityBuilder.create(this, parent, name, callback, factory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> CreateEntityBuilder<T, TFMGRegistrate> entity(String name,
|
||||
EntityType.EntityFactory<T> factory, MobCategory classification) {
|
||||
return this.entity(self(), name, factory, classification);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity, P> CreateEntityBuilder<T, P> entity(P parent, String name,
|
||||
EntityType.EntityFactory<T> factory, MobCategory classification) {
|
||||
return (CreateEntityBuilder<T, P>) this.entry(name, (callback) -> {
|
||||
return CreateEntityBuilder.create(this, parent, name, callback, factory, classification);
|
||||
});
|
||||
}
|
||||
|
||||
/* Palettes */
|
||||
|
||||
public <T extends Block> BlockBuilder<T, TFMGRegistrate> paletteStoneBlock(String name,
|
||||
NonNullFunction<Properties, T> factory, NonNullSupplier<Block> propertiesFrom, boolean worldGenStone,
|
||||
boolean hasNaturalVariants) {
|
||||
BlockBuilder<T, TFMGRegistrate> builder = super.block(name, factory).initialProperties(propertiesFrom)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(hasNaturalVariants ? BlockStateGen.naturalStoneTypeBlock(name) : (c, p) -> {
|
||||
final String location = "block/palettes/stone_types/" + c.getName();
|
||||
p.simpleBlock(c.get(), p.models()
|
||||
.cubeAll(c.getName(), p.modLoc(location)));
|
||||
})
|
||||
.tag(BlockTags.DRIPSTONE_REPLACEABLE)
|
||||
.tag(BlockTags.AZALEA_ROOT_REPLACEABLE)
|
||||
.tag(BlockTags.MOSS_REPLACEABLE)
|
||||
.tag(BlockTags.LUSH_GROUND_REPLACEABLE)
|
||||
.item()
|
||||
.model((c, p) -> p.cubeAll(c.getName(),
|
||||
p.modLoc(hasNaturalVariants ? "block/palettes/stone_types/natural/" + name + "_1"
|
||||
: "block/palettes/stone_types/" + c.getName())))
|
||||
.build();
|
||||
return builder;
|
||||
}
|
||||
|
||||
public BlockBuilder<Block, TFMGRegistrate> paletteStoneBlock(String name, NonNullSupplier<Block> propertiesFrom,
|
||||
boolean worldGenStone, boolean hasNaturalVariants) {
|
||||
return paletteStoneBlock(name, Block::new, propertiesFrom, worldGenStone, hasNaturalVariants);
|
||||
}
|
||||
|
||||
/* Fluids */
|
||||
|
||||
public <T extends ForgeFlowingFluid> FluidBuilder<T, TFMGRegistrate> virtualFluid(String name,
|
||||
FluidBuilder.FluidTypeFactory typeFactory, NonNullFunction<ForgeFlowingFluid.Properties, T> factory) {
|
||||
return entry(name,
|
||||
c -> new VirtualFluidBuilder<>(self(), self(), name, c, CreateTFMG.asResource("fluid/" + name + "_still"),
|
||||
CreateTFMG.asResource("fluid/" + name + "_flow"), typeFactory, factory));
|
||||
}
|
||||
|
||||
public <T extends ForgeFlowingFluid> FluidBuilder<T, TFMGRegistrate> virtualFluid(String name,
|
||||
ResourceLocation still, ResourceLocation flow, FluidBuilder.FluidTypeFactory typeFactory,
|
||||
NonNullFunction<ForgeFlowingFluid.Properties, T> factory) {
|
||||
return entry(name, c -> new VirtualFluidBuilder<>(self(), self(), name, c, still, flow, typeFactory, factory));
|
||||
}
|
||||
|
||||
public FluidBuilder<VirtualFluid, TFMGRegistrate> virtualFluid(String name) {
|
||||
return entry(name,
|
||||
c -> new VirtualFluidBuilder<VirtualFluid, TFMGRegistrate>(self(), self(), name, c,
|
||||
CreateTFMG.asResource("fluid/" + name + "_still"), CreateTFMG.asResource("fluid/" + name + "_flow"),
|
||||
TFMGRegistrate::defaultFluidType, VirtualFluid::new));
|
||||
}
|
||||
|
||||
public FluidBuilder<VirtualFluid, TFMGRegistrate> virtualFluid(String name, ResourceLocation still,
|
||||
ResourceLocation flow) {
|
||||
return entry(name, c -> new VirtualFluidBuilder<>(self(), self(), name, c, still, flow,
|
||||
TFMGRegistrate::defaultFluidType, VirtualFluid::new));
|
||||
}
|
||||
|
||||
public FluidBuilder<ForgeFlowingFluid.Flowing, TFMGRegistrate> standardFluid(String name) {
|
||||
return fluid(name, CreateTFMG.asResource("fluid/" + name + "_still"), CreateTFMG.asResource("fluid/" + name + "_flow"));
|
||||
}
|
||||
|
||||
public FluidBuilder<ForgeFlowingFluid.Flowing, TFMGRegistrate> standardFluid(String name,
|
||||
FluidBuilder.FluidTypeFactory typeFactory) {
|
||||
return fluid(name, CreateTFMG.asResource("fluid/" + name + "_still"), CreateTFMG.asResource("fluid/" + name + "_flow"),
|
||||
typeFactory);
|
||||
}
|
||||
|
||||
public static FluidType defaultFluidType(FluidType.Properties properties, ResourceLocation stillTexture,
|
||||
ResourceLocation flowingTexture) {
|
||||
return new FluidType(properties) {
|
||||
@Override
|
||||
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) {
|
||||
consumer.accept(new IClientFluidTypeExtensions() {
|
||||
@Override
|
||||
public ResourceLocation getStillTexture() {
|
||||
return stillTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getFlowingTexture() {
|
||||
return flowingTexture;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* Util */
|
||||
|
||||
public static <T extends Block> NonNullConsumer<? super T> casingConnectivity(
|
||||
BiConsumer<T, CasingConnectivity> consumer) {
|
||||
return entry -> onClient(() -> () -> registerCasingConnectivity(entry, consumer));
|
||||
}
|
||||
|
||||
public static <T extends Block> NonNullConsumer<? super T> blockModel(
|
||||
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
|
||||
return entry -> onClient(() -> () -> registerBlockModel(entry, func));
|
||||
}
|
||||
|
||||
public static <T extends Item> NonNullConsumer<? super T> itemModel(
|
||||
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
|
||||
return entry -> onClient(() -> () -> registerItemModel(entry, func));
|
||||
}
|
||||
|
||||
public static <T extends Block> NonNullConsumer<? super T> connectedTextures(
|
||||
Supplier<ConnectedTextureBehaviour> behavior) {
|
||||
return entry -> onClient(() -> () -> registerCTBehviour(entry, behavior));
|
||||
}
|
||||
|
||||
protected static void onClient(Supplier<Runnable> toRun) {
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, toRun);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static <T extends Block> void registerCasingConnectivity(T entry,
|
||||
BiConsumer<T, CasingConnectivity> consumer) {
|
||||
consumer.accept(entry, CreateClient.CASING_CONNECTIVITY);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void registerBlockModel(Block entry,
|
||||
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
|
||||
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
|
||||
.register(RegisteredObjects.getKeyOrThrow(entry), func.get());
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void registerItemModel(Item entry,
|
||||
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
|
||||
CreateClient.MODEL_SWAPPER.getCustomItemModels()
|
||||
.register(RegisteredObjects.getKeyOrThrow(entry), func.get());
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void registerCTBehviour(Block entry, Supplier<ConnectedTextureBehaviour> behaviorSupplier) {
|
||||
ConnectedTextureBehaviour behavior = behaviorSupplier.get();
|
||||
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
|
||||
.register(RegisteredObjects.getKeyOrThrow(entry), model -> new CTModel(model, behavior));
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_floor0"
|
||||
"model": "tfmg:block/fire/blue_fire_floor0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_floor1"
|
||||
"model": "tfmg:block/fire/blue_fire_floor1"
|
||||
}
|
||||
],
|
||||
"when": {
|
||||
@@ -20,16 +20,16 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side0"
|
||||
"model": "tfmg:block/fire/blue_fire_side0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side1"
|
||||
"model": "tfmg:block/fire/blue_fire_side1"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side_alt0"
|
||||
"model": "tfmg:block/fire/blue_fire_side_alt0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side_alt1"
|
||||
"model": "tfmg:block/fire/blue_fire_side_alt1"
|
||||
}
|
||||
],
|
||||
"when": {
|
||||
@@ -50,19 +50,19 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side0",
|
||||
"model": "tfmg:block/fire/blue_fire_side0",
|
||||
"y": 90
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side1",
|
||||
"model": "tfmg:block/fire/blue_fire_side1",
|
||||
"y": 90
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side_alt0",
|
||||
"model": "tfmg:block/fire/blue_fire_side_alt0",
|
||||
"y": 90
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side_alt1",
|
||||
"model": "tfmg:block/fire/blue_fire_side_alt1",
|
||||
"y": 90
|
||||
}
|
||||
],
|
||||
@@ -84,19 +84,19 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side0",
|
||||
"model": "tfmg:block/fire/blue_fire_side0",
|
||||
"y": 180
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side1",
|
||||
"model": "tfmg:block/fire/blue_fire_side1",
|
||||
"y": 180
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side_alt0",
|
||||
"model": "tfmg:block/fire/blue_fire_side_alt0",
|
||||
"y": 180
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side_alt1",
|
||||
"model": "tfmg:block/fire/blue_fire_side_alt1",
|
||||
"y": 180
|
||||
}
|
||||
],
|
||||
@@ -118,19 +118,19 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side0",
|
||||
"model": "tfmg:block/fire/blue_fire_side0",
|
||||
"y": 270
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side1",
|
||||
"model": "tfmg:block/fire/blue_fire_side1",
|
||||
"y": 270
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side_alt0",
|
||||
"model": "tfmg:block/fire/blue_fire_side_alt0",
|
||||
"y": 270
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_side_alt1",
|
||||
"model": "tfmg:block/fire/blue_fire_side_alt1",
|
||||
"y": 270
|
||||
}
|
||||
],
|
||||
@@ -152,16 +152,16 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_up0"
|
||||
"model": "tfmg:block/fire/blue_fire_up0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_up1"
|
||||
"model": "tfmg:block/fire/blue_fire_up1"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_up_alt0"
|
||||
"model": "tfmg:block/fire/blue_fire_up_alt0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/blue_fire_up_alt1"
|
||||
"model": "tfmg:block/fire/blue_fire_up_alt1"
|
||||
}
|
||||
],
|
||||
"when": {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/green_fire_floor0"
|
||||
"model": "tfmg:block/fire/green_fire_floor0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_floor1"
|
||||
"model": "tfmg:block/fire/green_fire_floor1"
|
||||
}
|
||||
],
|
||||
"when": {
|
||||
@@ -20,16 +20,16 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side0"
|
||||
"model": "tfmg:block/fire/green_fire_side0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side1"
|
||||
"model": "tfmg:block/fire/green_fire_side1"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side_alt0"
|
||||
"model": "tfmg:block/fire/green_fire_side_alt0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side_alt1"
|
||||
"model": "tfmg:block/fire/green_fire_side_alt1"
|
||||
}
|
||||
],
|
||||
"when": {
|
||||
@@ -50,19 +50,19 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side0",
|
||||
"model": "tfmg:block/fire/green_fire_side0",
|
||||
"y": 90
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side1",
|
||||
"model": "tfmg:block/fire/green_fire_side1",
|
||||
"y": 90
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side_alt0",
|
||||
"model": "tfmg:block/fire/green_fire_side_alt0",
|
||||
"y": 90
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side_alt1",
|
||||
"model": "tfmg:block/fire/green_fire_side_alt1",
|
||||
"y": 90
|
||||
}
|
||||
],
|
||||
@@ -84,19 +84,19 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side0",
|
||||
"model": "tfmg:block/fire/green_fire_side0",
|
||||
"y": 180
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side1",
|
||||
"model": "tfmg:block/fire/green_fire_side1",
|
||||
"y": 180
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side_alt0",
|
||||
"model": "tfmg:block/fire/green_fire_side_alt0",
|
||||
"y": 180
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side_alt1",
|
||||
"model": "tfmg:block/fire/green_fire_side_alt1",
|
||||
"y": 180
|
||||
}
|
||||
],
|
||||
@@ -118,19 +118,19 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side0",
|
||||
"model": "tfmg:block/fire/green_fire_side0",
|
||||
"y": 270
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side1",
|
||||
"model": "tfmg:block/fire/green_fire_side1",
|
||||
"y": 270
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side_alt0",
|
||||
"model": "tfmg:block/fire/green_fire_side_alt0",
|
||||
"y": 270
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_side_alt1",
|
||||
"model": "tfmg:block/fire/green_fire_side_alt1",
|
||||
"y": 270
|
||||
}
|
||||
],
|
||||
@@ -152,16 +152,16 @@
|
||||
{
|
||||
"apply": [
|
||||
{
|
||||
"model": "tfmg:block/green_fire_up0"
|
||||
"model": "tfmg:block/fire/green_fire_up0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_up1"
|
||||
"model": "tfmg:block/fire/green_fire_up1"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_up_alt0"
|
||||
"model": "tfmg:block/fire/green_fire_up_alt0"
|
||||
},
|
||||
{
|
||||
"model": "tfmg:block/green_fire_up_alt1"
|
||||
"model": "tfmg:block/fire/green_fire_up_alt1"
|
||||
}
|
||||
],
|
||||
"when": {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"itemGroup.tfmg.base": "Create: The Factory Must Grow",
|
||||
"itemGroup.tfmg.concrete": "Create: TFMG's Concrete"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/formwork_bottom",
|
||||
"particle": "tfmg:block/formwork_bottom"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 1, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/formwork_side",
|
||||
"particle": "tfmg:block/formwork_side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, -0.1],
|
||||
"to": [16, 16.001, 0.9],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 16], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 16], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 16, 1], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/formwork_bottom",
|
||||
"particle": "tfmg:block/formwork_bottom"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [1, 0, 1],
|
||||
"to": [15, 1, 15],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 14, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 14, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 14, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 14, 1], "texture": "#0"},
|
||||
"up": {"uv": [1, 1, 15, 15], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 14, 14], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "minecraft:block/block",
|
||||
"textures": {
|
||||
"0": "tfmg:block/formwork_bottom",
|
||||
"1": "tfmg:block/formwork_side",
|
||||
"particle": "tfmg:block/formwork_bottom"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [1, 1, 0],
|
||||
"to": [16, 16, 1],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 15, 15], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 1, 15], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 15, 15], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 1, 15], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 15, 1], "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 15, 1], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 1, 0],
|
||||
"to": [1, 16, 15],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 15], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 15, 15], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 1, 15], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 15, 15], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 15, 1], "rotation": 270, "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 15, 1], "rotation": 90, "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 1, 15],
|
||||
"to": [15, 16, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 15, 15], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 1, 15], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 15, 15], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 1, 15], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 15, 1], "rotation": 180, "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 15, 1], "rotation": 180, "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [15, 1, 1],
|
||||
"to": [16, 16, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 15], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 15, 15], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 1, 15], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 15, 15], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 15, 1], "rotation": 90, "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 15, 1], "rotation": 270, "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 1, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 16, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 150 B |
BIN
src/main/resources/assets/tfmg/textures/block/formwork_side.png
Normal file
BIN
src/main/resources/assets/tfmg/textures/block/formwork_side.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 B |
Reference in New Issue
Block a user