Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "gtceu:block/creosote"
}
}
}
4 changes: 3 additions & 1 deletion src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
"block.gtceu.creative_data_access_hatch": "ɥɔʇɐH ssǝɔɔⱯ ɐʇɐᗡ ǝʌıʇɐǝɹƆ",
"block.gtceu.creative_energy": "ʎbɹǝuƎ ǝʌıʇɐǝɹƆ",
"block.gtceu.creative_tank": "ʞuɐ⟘ ǝʌıʇɐǝɹƆ",
"block.gtceu.creosote": "ǝʇosoǝɹƆ",
"block.gtceu.crushing_wheels": "sןǝǝɥM buıɥsnɹƆ",
"block.gtceu.cupronickel_coil_block": "ʞɔoןᗺ ןıoƆ ןǝʞɔıuoɹdnƆ",
"block.gtceu.cyan_borderless_lamp": "dɯɐꞀ ssǝןɹǝpɹoᗺ uɐʎƆ",
Expand Down Expand Up @@ -902,6 +903,7 @@
"block.gtceu.normal_optical_pipe": "ǝןqɐƆ ɹǝqıℲ ןɐɔıʇdO",
"block.gtceu.normal_optical_pipe.tooltip": "ㄥ§ɐʇɐᗡ ɥɔɹɐǝsǝᴚɟ§ ɹo ㄥ§uoıʇɐʇndɯoƆɟ§ buıʇʇıɯsuɐɹ⟘ㄥ§",
"block.gtceu.object_holder": "ɹǝpןoH ʇɔǝظqO",
"block.gtceu.oil": "ןıO",
"block.gtceu.oil_heavy": "ןıO ʎʌɐǝH",
"block.gtceu.oil_light": "ןıO ʇɥbıꞀ",
"block.gtceu.oil_medium": "ןıO ʍɐᴚ",
Expand Down Expand Up @@ -1822,7 +1824,7 @@
"config.gtceu.option.machines": "sǝuıɥɔɐɯ",
"config.gtceu.option.machinesEmissiveTextures": "sǝɹnʇxǝ⟘ǝʌıssıɯƎsǝuıɥɔɐɯ",
"config.gtceu.option.machinesHaveBERsByDefault": "ʇןnɐɟǝᗡʎᗺsᴚƎᗺǝʌɐHsǝuıɥɔɐɯ",
"config.gtceu.option.maintenanceTime": "ǝɯı⟘ǝɔuɐuǝʇuıɐɯ",
"config.gtceu.option.maintenanceCheckRate": "ǝʇɐᴚʞɔǝɥƆǝɔuɐuǝʇuıɐɯ",
"config.gtceu.option.meHatchEnergyUsage": "ǝbɐs∩ʎbɹǝuƎɥɔʇɐHǝɯ",
"config.gtceu.option.minerSpeed": "pǝǝdSɹǝuıɯ",
"config.gtceu.option.minimap": "dɐɯıuıɯ",
Expand Down
4 changes: 3 additions & 1 deletion src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
"block.gtceu.creative_data_access_hatch": "Creative Data Access Hatch",
"block.gtceu.creative_energy": "Creative Energy",
"block.gtceu.creative_tank": "Creative Tank",
"block.gtceu.creosote": "Creosote",
"block.gtceu.crushing_wheels": "Crushing Wheels",
"block.gtceu.cupronickel_coil_block": "Cupronickel Coil Block",
"block.gtceu.cyan_borderless_lamp": "Cyan Borderless Lamp",
Expand Down Expand Up @@ -902,6 +903,7 @@
"block.gtceu.normal_optical_pipe": "Optical Fiber Cable",
"block.gtceu.normal_optical_pipe.tooltip": "§7Transmitting §fComputation§7 or §fResearch Data§7",
"block.gtceu.object_holder": "Object Holder",
"block.gtceu.oil": "Oil",
"block.gtceu.oil_heavy": "Heavy Oil",
"block.gtceu.oil_light": "Light Oil",
"block.gtceu.oil_medium": "Raw Oil",
Expand Down Expand Up @@ -1822,7 +1824,7 @@
"config.gtceu.option.machines": "machines",
"config.gtceu.option.machinesEmissiveTextures": "machinesEmissiveTextures",
"config.gtceu.option.machinesHaveBERsByDefault": "machinesHaveBERsByDefault",
"config.gtceu.option.maintenanceTime": "maintenanceTime",
"config.gtceu.option.maintenanceCheckRate": "maintenanceCheckRate",
"config.gtceu.option.meHatchEnergyUsage": "meHatchEnergyUsage",
"config.gtceu.option.minerSpeed": "minerSpeed",
"config.gtceu.option.minimap": "minimap",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "gtceu:block/fluids/fluid.creosote"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class FluidBuilder {
private boolean hasCustomStill = false;
private boolean hasCustomFlowing = false;

@Getter
private boolean hasFluidBlock = false;
private boolean hasBucket = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
import com.gregtechceu.gtceu.api.fluids.GTFluid;

import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.common.SoundActions;
import net.minecraftforge.common.extensions.IForgeFluid;
import net.minecraftforge.fluids.FluidType;

import org.jetbrains.annotations.NotNull;

import java.util.Optional;
import java.util.function.Supplier;

import javax.annotation.ParametersAreNonnullByDefault;
Expand All @@ -35,6 +38,12 @@ public FluidType getFluidType() {
return fluidType.get();
}

@Override
public Optional<SoundEvent> getPickupSound() {
Comment thread
serenibyss marked this conversation as resolved.
return fluidType != null && fluidType.get() != null ?
Optional.ofNullable(fluidType.get().getSound(SoundActions.BUCKET_FILL)) : Optional.empty();
}

public static class Source extends GTFluidImpl {

public Source(@NotNull FluidState state, Supplier<? extends Fluid> stillFluid,
Expand Down
121 changes: 88 additions & 33 deletions src/main/java/com/gregtechceu/gtceu/api/item/GTBucketItem.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.gregtechceu.gtceu.api.item;

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.data.chemical.material.Material;
import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey;
import com.gregtechceu.gtceu.api.fluids.GTFluid;
import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKey;
import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys;

import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
Expand Down Expand Up @@ -89,46 +92,98 @@ public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType)
}

@Override
public boolean emptyContents(@Nullable Player pPlayer, Level pLevel, BlockPos pPos,
@Nullable BlockHitResult pResult,
public boolean emptyContents(@Nullable Player player, Level level, BlockPos pos,
Comment thread
serenibyss marked this conversation as resolved.
@Nullable BlockHitResult result,
@Nullable ItemStack container) {
if (!(this.getFluid() instanceof FlowingFluid)) return false;

BlockState blockstate = pLevel.getBlockState(pPos);
BlockState blockstate = level.getBlockState(pos);
Block block = blockstate.getBlock();
boolean flag = blockstate.canBeReplaced(this.getFluid());
boolean flag1 = blockstate.isAir() || flag || block instanceof LiquidBlockContainer &&
((LiquidBlockContainer) block).canPlaceLiquid(pLevel, pPos, blockstate, this.getFluid());
Optional<net.minecraftforge.fluids.FluidStack> containedFluidStack = Optional
.ofNullable(container).flatMap(FluidUtil::getFluidContained);
if (!flag1) {
return pResult != null && this.emptyContents(pPlayer, pLevel,
pResult.getBlockPos().relative(pResult.getDirection()), null, container);
} else if (containedFluidStack.isPresent() &&
this.getFluid().getFluidType().isVaporizedOnPlacement(pLevel, pPos, containedFluidStack.get())) {
this.getFluid().getFluidType().onVaporize(pPlayer, pLevel, pPos, containedFluidStack.get());
boolean canReplace = blockstate.canBeReplaced(this.getFluid());
boolean canPlace = blockstate.isAir() || canReplace ||
block instanceof LiquidBlockContainer lbc &&
lbc.canPlaceLiquid(level, pos, blockstate, this.getFluid());

if (!canPlace) {
return result != null && this.emptyContents(player, level,
result.getBlockPos().relative(result.getDirection()), null, container);
}

var fluidType = this.getFluid().getFluidType();
Optional<FluidStack> containedFluidStack = Optional.ofNullable(container).flatMap(FluidUtil::getFluidContained);
if (containedFluidStack.isPresent() &&
fluidType.isVaporizedOnPlacement(level, pos, containedFluidStack.get())) {
fluidType.onVaporize(player, level, pos, containedFluidStack.get());
return true;
}

if (doesFluidVaporize(material, level)) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
level.playSound(player, pos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F,
2.6F + (level.random.nextFloat() - level.random.nextFloat()) * 0.8F);

for (int l = 0; l < 8; ++l) {
double xi = i + GTValues.RNG.nextDouble();
double xj = j + GTValues.RNG.nextDouble();
double xk = k + GTValues.RNG.nextDouble();
Comment thread
serenibyss marked this conversation as resolved.
level.addParticle(ParticleTypes.LARGE_SMOKE, xi, xj, xk, 0.0D, 0.0D, 0.0D);
}
return true;
}

if (block instanceof LiquidBlockContainer blockContainer &&
blockContainer.canPlaceLiquid(level, pos, blockstate, getFluid())) {
var flowingFluid = ((FlowingFluid) this.getFluid());
blockContainer.placeLiquid(level, pos, blockstate, flowingFluid.getSource(false));
this.playEmptySound(player, level, pos);
return true;
} else {
if (!level.isClientSide && canReplace && !blockstate.liquid()) {
level.destroyBlock(pos, true);
}

var fluidBlockState = material.getFluid().defaultFluidState().createLegacyBlock();
Comment thread
YoungOnionMC marked this conversation as resolved.
if (hasFluidBlock(material) && level.setBlock(pos, fluidBlockState, Block.UPDATE_ALL_IMMEDIATE) &&
fluidBlockState.getFluidState().isSource()) {
this.playEmptySound(player, level, pos);
return true;
}
}
return false;
}

private static boolean hasFluidBlock(Material mat) {
var fluidStorage = mat.getProperty(PropertyKey.FLUID).getStorage();

for (var key : FluidStorageKey.allKeys()) {
var fluidEntry = fluidStorage.getEntry(key);
if (fluidEntry != null) {
var fluidBuilder = fluidEntry.getBuilder();
if (fluidBuilder != null && fluidBuilder.hasFluidBlock()) {
return true;
} else
if (pLevel.dimensionType().ultraWarm() && this.getFluid().is(FluidTags.WATER)) {
int i = pPos.getX();
int j = pPos.getY();
int k = pPos.getZ();
pLevel.playSound(pPlayer, pPos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F,
2.6F + (pLevel.random.nextFloat() - pLevel.random.nextFloat()) * 0.8F);

for (int l = 0; l < 8; ++l) {
pLevel.addParticle(ParticleTypes.LARGE_SMOKE, (double) i + Math.random(),
(double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
}
}
}
return false;
}

return true;
} else if (block instanceof LiquidBlockContainer &&
((LiquidBlockContainer) block).canPlaceLiquid(pLevel, pPos, blockstate, getFluid())) {
((LiquidBlockContainer) block).placeLiquid(pLevel, pPos, blockstate,
((FlowingFluid) this.getFluid()).getSource(false));
this.playEmptySound(pPlayer, pLevel, pPos);
return true;
}
private boolean doesFluidVaporize(Material mat, Level level) {
// water in nether behavior
if (level.dimensionType().ultraWarm() && this.getFluid().defaultFluidState().is(FluidTags.WATER)) {
return true;
}
var fluidStorage = mat.getProperty(PropertyKey.FLUID).getStorage();
var plasmaEntry = fluidStorage.getEntry(FluidStorageKeys.PLASMA);
var gasEntry = fluidStorage.getEntry(FluidStorageKeys.GAS);
if (plasmaEntry != null) {
var plasmaBuilder = plasmaEntry.getBuilder();
return plasmaBuilder != null && plasmaBuilder.hasFluidBlock();
} else if (gasEntry != null) {
var gasBuilder = gasEntry.getBuilder();
return gasBuilder != null && gasBuilder.hasFluidBlock();
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ public static void init() {
}

GTCovers.init();
GTFluids.init();
GTCreativeModeTabs.init();
GTBlocks.init();
GTFluids.init();
GTEntityTypes.init();
GTBlockEntities.init();
GTRecipeTypes.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void register() {
.buildAndRegister();

Creosote = new Material.Builder(GTCEu.id("creosote"))
.liquid(new FluidBuilder().customStill().burnTime(6400)).color(0x804000)
.liquid(new FluidBuilder().block().customStill().burnTime(6400)).color(0x804000)
.flags(STICKY).buildAndRegister();

Diesel = new Material.Builder(GTCEu.id("diesel"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ public static void init(RegistrateLangProvider provider) {
replace(provider, "block.gtceu.oil_heavy", "Heavy Oil");
replace(provider, "block.gtceu.oil_light", "Light Oil");
replace(provider, "block.gtceu.oil_medium", "Raw Oil");
replace(provider, "block.gtceu.oil", "Oil");
replace(provider, "block.gtceu.creosote", "Creosote");

replace(provider, GTBlocks.BATTERY_EMPTY_TIER_I.get().getDescriptionId(), "Empty Tier I Capacitor");
replace(provider, GTBlocks.BATTERY_LAPOTRONIC_EV.get().getDescriptionId(), "EV Lapotronic Capacitor");
Expand Down