Balanced Blaze Burners

- Adjust how and when blaze burners accept fuel
- Fix crash with Optifine when rendering a map
- Fix RenderType being used in common code
- Increment version
This commit is contained in:
PepperCode1 2023-01-13 16:47:33 -08:00
parent 324729a68e
commit 6e6b8550b8
7 changed files with 40 additions and 18 deletions

View file

@ -49,6 +49,7 @@ body:
label: Mod Version
description: The version of the mod you were using when the bug occured
options:
- "0.5.0h"
- "0.5.0g"
- "0.5.0f"
- "0.5.0e"

View file

@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false
# mod version info
mod_version = 0.5.0.g
mod_version = 0.5.0.h
artifact_minecraft_version = 1.18.2
minecraft_version = 1.18.2
@ -21,7 +21,7 @@ parchment_version = 2022.11.06
# dependency versions
registrate_version = MC1.18.2-1.1.3
flywheel_minecraft_version = 1.18.2
flywheel_version = 0.6.8-97
flywheel_version = 0.6.8.a-99
jei_minecraft_version = 1.18.2
jei_version = 9.7.0.209
curios_minecraft_version = 1.18.2

View file

@ -67,7 +67,7 @@ public class Create {
public static final String ID = "create";
public static final String NAME = "Create";
public static final String VERSION = "0.5g";
public static final String VERSION = "0.5h";
public static final Logger LOGGER = LogUtils.getLogger();

View file

@ -55,19 +55,20 @@ public class WhistleTileEntity extends SmartTileEntity implements IHaveGoggleInf
public void updatePitch() {
BlockPos currentPos = worldPosition.above();
int prevPitch = pitch;
for (pitch = 0; pitch <= 24; pitch += 2) {
int newPitch;
for (newPitch = 0; newPitch <= 24; newPitch += 2) {
BlockState blockState = level.getBlockState(currentPos);
if (!AllBlocks.STEAM_WHISTLE_EXTENSION.has(blockState))
break;
if (blockState.getValue(WhistleExtenderBlock.SHAPE) == WhistleExtenderShape.SINGLE) {
pitch++;
newPitch++;
break;
}
currentPos = currentPos.above();
}
if (prevPitch == pitch)
if (pitch == newPitch)
return;
pitch = newPitch;
notifyUpdate();

View file

@ -35,6 +35,8 @@ import net.minecraftforge.common.ForgeHooks;
public class BlazeBurnerTileEntity extends SmartTileEntity {
public static final int MAX_HEAT_CAPACITY = 10000;
public static final int INSERTION_THRESHOLD = 500;
public static final int SPECIAL_INSERTION_THRESHOLD = 100;
protected FuelType activeFuel;
protected int remainingBurnTime;
@ -166,7 +168,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
}
public void updateBlockState() {
setBlockHeat(getHeatLevelFromFuelType(activeFuel));
setBlockHeat(getHeatLevel());
}
protected void setBlockHeat(HeatLevel heat) {
@ -192,10 +194,10 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
newBurnTime = 1000;
newFuel = FuelType.SPECIAL;
} else {
newBurnTime = (int) Math.min(ForgeHooks.getBurnTime(itemStack, null), MAX_HEAT_CAPACITY * 0.95f);
if (newBurnTime > 0)
newBurnTime = ForgeHooks.getBurnTime(itemStack, null);
if (newBurnTime > 0) {
newFuel = FuelType.NORMAL;
else if (AllItemTags.BLAZE_BURNER_FUEL_REGULAR.matches(itemStack)) {
} else if (AllItemTags.BLAZE_BURNER_FUEL_REGULAR.matches(itemStack)) {
newBurnTime = 1600; // Same as coal
newFuel = FuelType.NORMAL;
}
@ -205,13 +207,19 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
return false;
if (newFuel.ordinal() < activeFuel.ordinal())
return false;
if (activeFuel == FuelType.SPECIAL && remainingBurnTime > 20)
return false;
if (newFuel == activeFuel) {
if (remainingBurnTime + newBurnTime > MAX_HEAT_CAPACITY && !forceOverflow)
if (remainingBurnTime <= (activeFuel == FuelType.NORMAL ? INSERTION_THRESHOLD : SPECIAL_INSERTION_THRESHOLD)) {
newBurnTime += remainingBurnTime;
} else if (forceOverflow && newFuel == FuelType.NORMAL) {
if (remainingBurnTime < MAX_HEAT_CAPACITY) {
newBurnTime = Math.min(remainingBurnTime + newBurnTime, MAX_HEAT_CAPACITY);
} else {
newBurnTime = remainingBurnTime;
}
} else {
return false;
newBurnTime = Mth.clamp(remainingBurnTime + newBurnTime, 0, MAX_HEAT_CAPACITY);
}
}
if (simulate)
@ -268,7 +276,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
.125f + level.random.nextFloat() * .125f, .75f - level.random.nextFloat() * .25f);
}
protected HeatLevel getHeatLevelFromFuelType(FuelType fuel) {
protected HeatLevel getHeatLevel() {
HeatLevel level = HeatLevel.SMOULDERING;
switch (activeFuel) {
case SPECIAL:

View file

@ -21,6 +21,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.saveddata.maps.MapDecoration;
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
@ -104,7 +105,7 @@ public class StationMarker {
}
public static class Decoration extends MapDecoration implements CustomRenderedMapDecoration {
private static final RenderType RENDER_TYPE = RenderType.text(Create.asResource("textures/gui/station_map_icon.png"));
private static final ResourceLocation TEXTURE = Create.asResource("textures/gui/station_map_icon.png");
public Decoration(byte x, byte y, Component name) {
super(TYPE, x, y, (byte) 0, name);
@ -130,7 +131,7 @@ public class StationMarker {
poseStack.translate(0.5f, 0f, 0);
poseStack.scale(4.5F, 4.5F, 3.0F);
VertexConsumer buffer = bufferSource.getBuffer(RENDER_TYPE);
VertexConsumer buffer = bufferSource.getBuffer(RenderType.text(TEXTURE));
Matrix4f mat = poseStack.last().pose();
float zOffset = -0.001f;
buffer.vertex(mat, -1, -1, zOffset * index).color(255, 255, 255, 255).uv(0.0f , 0.0f ).uv2(packedLight).endVertex();

View file

@ -2,9 +2,11 @@ package com.simibubi.create.foundation.mixin;
import java.util.Iterator;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@ -23,10 +25,19 @@ public class MapRendererMapInstanceMixin {
@Shadow
private MapItemSavedData data;
@Group(name = "custom_decoration_rendering", min = 1, max = 1)
@Inject(method = "draw(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ZI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/saveddata/maps/MapDecoration;render(I)Z", remap = false), locals = LocalCapture.CAPTURE_FAILHARD)
private void onDraw(PoseStack poseStack, MultiBufferSource bufferSource, boolean active, int packedLight, CallbackInfo ci, int i, int j, float f, Matrix4f matrix4f, VertexConsumer vertexConsumer, int index, Iterator<MapDecoration> iterator, MapDecoration decoration) {
if (decoration instanceof CustomRenderedMapDecoration renderer) {
renderer.render(poseStack, bufferSource, active, packedLight, data, index);
}
}
@Group(name = "custom_decoration_rendering")
@Inject(method = "draw(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ZI)V", at = @At(value = "FIELD", target = "net/optifine/reflect/Reflector.ForgeMapDecoration_render:Lnet/optifine/reflect/ReflectorMethod;", opcode = Opcodes.GETSTATIC, ordinal = 1, remap = false), locals = LocalCapture.CAPTURE_FAILHARD)
private void onDrawOptifine(PoseStack poseStack, MultiBufferSource bufferSource, boolean active, int packedLight, CallbackInfo ci, int i, int j, float f, Matrix4f matrix4f, VertexConsumer vertexConsumer, int index, Iterator<MapDecoration> iterator, MapDecoration decoration) {
if (decoration instanceof CustomRenderedMapDecoration renderer) {
renderer.render(poseStack, bufferSource, active, packedLight, data, index);
}
}
}