CONCRETE REWORK POG
This commit is contained in:
@@ -25,7 +25,7 @@ public class CreateTFMG
|
||||
|
||||
public static final String MOD_ID = "tfmg";
|
||||
public static final CreateRegistrate REGISTRATE = CreateRegistrate.create(MOD_ID);
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public CreateTFMG()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.drmangotea.tfmg.content.concrete;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.ThermiteGrenade;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.animal.Sheep;
|
||||
import net.minecraft.world.entity.projectile.Arrow;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.LavaFluid;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
|
||||
public class ConcreteFluid extends ForgeFlowingFluid {
|
||||
|
||||
|
||||
protected ConcreteFluid(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSource(FluidState p_76140_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount(FluidState p_164509_) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(Level level, BlockPos pos, FluidState p_230574_, RandomSource randomSource) {
|
||||
int random = randomSource.nextInt(7) ;
|
||||
|
||||
if(random==2) {
|
||||
level.setBlock(pos, TFMGBlocks.CONCRETE.get().defaultBlockState(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isRandomlyTicking() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
public static class Flowing extends ConcreteFluid {
|
||||
public Flowing(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> p_76260_) {
|
||||
super.createFluidStateDefinition(p_76260_);
|
||||
p_76260_.add(LEVEL);
|
||||
}
|
||||
|
||||
public int getAmount(FluidState p_76264_) {
|
||||
return p_76264_.getValue(LEVEL);
|
||||
}
|
||||
|
||||
public boolean isSource(FluidState p_76262_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Source extends ConcreteFluid {
|
||||
public Source(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
public int getAmount(FluidState p_76269_) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public boolean isSource(FluidState p_76267_) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.drmangotea.tfmg.content.concrete;
|
||||
|
||||
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ConcreteFluidType extends AllFluids.TintedFluidType {
|
||||
|
||||
private Vector3f fogColor;
|
||||
private Supplier<Float> fogDistance;
|
||||
|
||||
public static FluidBuilder.FluidTypeFactory create(int fogColor, Supplier<Float> fogDistance) {
|
||||
return (p, s, f) -> {
|
||||
ConcreteFluidType fluidType = new ConcreteFluidType(p, s, f);
|
||||
fluidType.fogColor = new Color(fogColor, false).asVectorF();
|
||||
fluidType.fogDistance = fogDistance;
|
||||
return fluidType;
|
||||
};
|
||||
}
|
||||
|
||||
private ConcreteFluidType(Properties properties, ResourceLocation stillTexture,
|
||||
ResourceLocation flowingTexture) {
|
||||
super(properties, stillTexture, flowingTexture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTintColor(FluidStack stack) {
|
||||
return NO_TINT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Removing alpha from tint prevents optifine from forcibly applying biome
|
||||
* colors to modded fluids (this workaround only works for fluids in the solid
|
||||
* render layer)
|
||||
*/
|
||||
@Override
|
||||
public int getTintColor(FluidState state, BlockAndTintGetter world, BlockPos pos) {
|
||||
return 0x00ffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vector3f getCustomFogColor() {
|
||||
return fogColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getFogDistanceModifier() {
|
||||
return fogDistance.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSwim(Entity entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public float getFallDistanceModifier(Entity entity)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity)
|
||||
{
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().scale(0.2d));
|
||||
//entity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 30, 5, true, false, false));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -107,6 +107,17 @@ public class TFMGBlocks {
|
||||
static {
|
||||
REGISTRATE.creativeModeTab(() -> TFMGCreativeModeTabs.TFMG_CONCRETE);
|
||||
}
|
||||
public static final BlockEntry<Block> CONCRETE = REGISTRATE.block("concrete", Block::new)
|
||||
.initialProperties(() -> Blocks.STONE)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll("concrete"))
|
||||
.tag(BlockTags.NEEDS_IRON_TOOL)
|
||||
.transform(tagBlockAndItem("concrete"))
|
||||
.build()
|
||||
.lang("Concrete")
|
||||
.register();
|
||||
|
||||
public static void register() {}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.content.concrete.ConcreteFluid;
|
||||
import com.drmangotea.tfmg.content.concrete.ConcreteFluidType;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.AllTags;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -298,22 +301,29 @@ public class TFMGFluids {
|
||||
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> LIQUID_CONCRETE =
|
||||
REGISTRATE.fluid("liquid_concrete",CONCRETE_RL,CONCRETE_RL)
|
||||
REGISTRATE.fluid("liquid_concrete",CONCRETE_RL,CONCRETE_RL,
|
||||
ConcreteFluidType.create(0x333333,
|
||||
() -> 1f / 24f ))
|
||||
.lang("Liquid Concrete")
|
||||
.properties(b -> b.viscosity(9999)
|
||||
.density(9999))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(0)
|
||||
.tickRate(9999)
|
||||
.tickRate(99999)
|
||||
.slopeFindDistance(0)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.explosionResistance(4f)
|
||||
)
|
||||
.source(ConcreteFluid.Source::new)
|
||||
.bucket()
|
||||
//.tag(AllTags.forgeItemTag("buckets/napalm"))
|
||||
.build()
|
||||
.register();
|
||||
|
||||
|
||||
////
|
||||
|
||||
|
||||
|
||||
|
||||
// Load this class
|
||||
|
||||
public static void register() {
|
||||
|
||||
Reference in New Issue
Block a user