Update steam particles
Improved engine
fix cogwheel
This commit is contained in:
khj xiaogu 2022-05-22 17:57:45 +08:00
parent 9a0c6d9645
commit 601ede8c62
No known key found for this signature in database
GPG key ID: DEA172814EAFF426
16 changed files with 35 additions and 22 deletions

View file

@ -1,2 +1,4 @@
2.0.2-alpha:
- Update to support Minecraft 1.18.2, Create 0.4.1, Flywheel 0.6.2, and Forge 40.0.0
2.0.3-alpha:
- Updated Steam particles
- Improved Steam Engine Logics
- Fix cogwheels' breaking particles

View file

@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# mod version info
mod_version = 2.0.2-alpha
mod_version = 2.0.3-alpha
minecraft_version = 1.18.2
forge_version = 40.0.34

View file

@ -35,8 +35,13 @@ public class ParticleBase extends TextureSheetParticle {
public ParticleBase(ClientLevel world, double x, double y, double z, double motionX, double motionY, double motionZ) {
super(world, x, y, z, motionX, motionY, motionZ);
this.xd*=1.25;
this.yd*=1.25;
this.zd*=1.25;
}
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
}
@ -46,8 +51,8 @@ public class ParticleBase extends TextureSheetParticle {
float age = (this.age + pt) / lifetime * 32.0F;
age = Mth.clamp(age, 0.0F, 1.0F);
super.quadSize = originalScale * age;
super.alpha=Mth.clamp(1-(this.age + pt) / lifetime, 0.0F, 1.0F);
super.quadSize = originalScale*(age+this.age*0.0375F);
super.render(worldRendererIn, entityIn, pt);
}
@ -58,7 +63,6 @@ public class ParticleBase extends TextureSheetParticle {
if (age >= lifetime)
super.remove();
this.age++;
this.yd -= 0.04D * gravity;
move(xd,yd, zd);
@ -66,7 +70,6 @@ public class ParticleBase extends TextureSheetParticle {
this.xd *= 1.1D;
this.zd *= 1.1D;
}
this.xd *= 0.96D;
this.yd *= 0.96D;
this.zd *= 0.96D;

View file

@ -28,10 +28,10 @@ public class SteamParticle extends ParticleBase {
public SteamParticle(ClientLevel world, double x, double y, double z, double motionX, double motionY, double motionZ) {
super(world, x, y, z, motionX, motionY, motionZ);
this.gravity = -0.1F;
this.rCol = this.gCol = this.bCol = (float) (Math.random() * 0.4) + 0.4f;
this.gravity = -0.05F;
this.rCol = this.gCol = this.bCol = (float) (Math.random() * 0.2) + 0.8f;
this.originalScale = 0.25F;
this.lifetime= (int) (12.0D / (Math.random() * 0.8D + 0.2D));
this.lifetime= (int) (80.0D / (Math.random() * 0.2D + 0.8D));
}
public static class Factory implements ParticleProvider<SimpleParticleType> {

View file

@ -89,7 +89,7 @@ public abstract class BoilerBlock extends Block implements LiquidBlockContainer
double d2 = p_180655_3_.getZ();
//if(p_180655_4_.nextDouble()<0.5D) {
p_180655_2_.playLocalSound(d0, d1, d2, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.25F, 0.25F, false);
int count=4;
int count=8;
while(--count!=0)
p_180655_2_.addParticle(Particles.STEAM.get(), d0+p_180655_4_.nextFloat(), d1, d2+p_180655_4_.nextFloat(), 0.0D, 0.0D, 0.0D);
//}

View file

@ -31,12 +31,10 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
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.minecraft.world.level.material.Fluid;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -70,28 +68,38 @@ public abstract class SteamEngineTileEntity extends EngineTileEntity implements
if (level != null && !level.isClientSide) {
BlockState state = this.level.getBlockState(this.worldPosition);
if (this.poweredWheel == null || this.poweredWheel.isRemoved()) {
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
this.appliedCapacity = 0;
this.appliedSpeed = 0;
this.refreshWheelSpeed();
heatup = 0;
tank.drain(this.getSteamConsumptionPerTick(), IFluidHandler.FluidAction.EXECUTE);
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
} else {
if(heatup==0&&tank.getFluidAmount()<=this.getSteamConsumptionPerTick()*20) {
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
this.setChanged();
return;
}
if (!tank.isEmpty() && tank.drain(this.getSteamConsumptionPerTick(), IFluidHandler.FluidAction.EXECUTE)
.getAmount() >= this.getSteamConsumptionPerTick()) {
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, true));
if (heatup >= 60) {
this.appliedCapacity = this.getGeneratingCapacity();
this.appliedSpeed = this.getGeneratingSpeed();
this.refreshWheelSpeed();
} else
heatup++;
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, true));
} else {
if (heatup > 0)
heatup--;
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
this.appliedCapacity = 0;
this.appliedSpeed = 0;
this.refreshWheelSpeed();
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
}
}
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
this.setChanged();

View file

@ -5,7 +5,7 @@
"textures": {
"0": "create:block/axis",
"3": "create:block/axis_top",
"particle": "block/stripped_spruce_log",
"particle": "steampowered:block/cogwheel/bronze_cogwheel",
"1_2": "steampowered:block/cogwheel/bronze_cogwheel"
},
"elements": [

View file

@ -5,7 +5,7 @@
"textures": {
"0": "create:block/axis",
"3": "create:block/axis_top",
"particle": "block/stripped_spruce_log",
"particle": "steampowered:block/cogwheel/bronze_large_cogwheel",
"4": "steampowered:block/cogwheel/bronze_large_cogwheel"
},
"elements": [

View file

@ -5,7 +5,7 @@
"textures": {
"0": "create:block/axis",
"3": "create:block/axis_top",
"particle": "block/stripped_spruce_log",
"particle": "steampowered:block/cogwheel/cast_iron_cogwheel",
"1_2": "steampowered:block/cogwheel/cast_iron_cogwheel"
},
"elements": [

View file

@ -5,7 +5,7 @@
"textures": {
"0": "create:block/axis",
"3": "create:block/axis_top",
"particle": "block/stripped_spruce_log",
"particle": "steampowered:block/cogwheel/cast_iron_large_cogwheel",
"4": "steampowered:block/cogwheel/cast_iron_large_cogwheel"
},
"elements": [

View file

@ -5,7 +5,7 @@
"textures": {
"0": "create:block/axis",
"3": "create:block/axis_top",
"particle": "block/stripped_spruce_log",
"particle": "steampowered:block/cogwheel/steel_cogwheel",
"1_2": "steampowered:block/cogwheel/steel_cogwheel"
},
"elements": [

View file

@ -5,7 +5,7 @@
"textures": {
"0": "create:block/axis",
"3": "create:block/axis_top",
"particle": "block/stripped_spruce_log",
"particle": "steampowered:block/cogwheel/steel_large_cogwheel",
"4": "steampowered:block/cogwheel/steel_large_cogwheel"
},
"elements": [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 367 B