tick off some todos

This commit is contained in:
zelophed 2021-03-28 04:19:58 +02:00
parent 6e0e3d28fd
commit 683d18b994
9 changed files with 47 additions and 24 deletions

View file

@ -59,8 +59,8 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float stressBase = calculateAddedStressCapacity();
if (stressBase != 0 && IRotate.StressImpact.isEnabled()) {
tooltip.add(new StringTextComponent(spacing).append(Lang.translate("gui.goggles.generator_stats")));
tooltip.add(new StringTextComponent(spacing).append(Lang.translate("tooltip.capacityProvided").formatted(TextFormatting.GRAY)));
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.goggles.generator_stats")));
tooltip.add(componentSpacing.copy().append(Lang.translate("tooltip.capacityProvided").formatted(TextFormatting.GRAY)));
float speed = getTheoreticalSpeed();
if (speed != getGeneratedSpeed() && speed != 0)
@ -69,12 +69,13 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
speed = Math.abs(speed);
float stressTotal = stressBase * speed;
// FIXME add colours back
// String stressString = spacing + "%s" + Lang.translate("generic.unit.stress").getUnformattedComponentText() + " %s";
// tooltip.add(new StringTextComponent(String.format(stressString, IHaveGoggleInformation.format(stressBase), Lang.translate("gui.goggles.base_value").getUnformattedComponentText())));
// tooltip.add(new StringTextComponent(String.format(stressString, IHaveGoggleInformation.format(stressTotal), Lang.translate("gui.goggles.at_current_speed").getUnformattedComponentText())));
tooltip.add(componentSpacing.copy().append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress")).append(" ").formatted(TextFormatting.AQUA)).append(Lang.translate("gui.goggles.at_current_speed").formatted(TextFormatting.DARK_GRAY)));
tooltip.add(
componentSpacing.copy()
.append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress"))
.formatted(TextFormatting.AQUA))
.append(" ")
.append(Lang.translate("gui.goggles.at_current_speed").formatted(TextFormatting.DARK_GRAY)));
added = true;
}

View file

@ -85,7 +85,7 @@ public interface IHaveGoggleInformation {
return true;
ITextComponent capacity = Lang.translate("gui.goggles.fluid_container.capacity").formatted(TextFormatting.GRAY);
ITextComponent amount = new StringTextComponent(format(tank.getTankCapacity(0)) + mb).formatted(TextFormatting.GOLD);
ITextComponent amount = new StringTextComponent(format(tank.getTankCapacity(0))).append(mb).formatted(TextFormatting.GOLD);
tooltip.add(indent.copy()
.append(capacity)

View file

@ -54,7 +54,7 @@ public enum SequencerInstructions {
String formatValue(int value) {
if (this == TURN_ANGLE)
return value + Lang.translate("generic.unit.degrees").getUnformattedComponentText(); // FIXME
return value + Lang.translate("generic.unit.degrees").getString();
if (this == TURN_DISTANCE)
return value + "m";
if (this == DELAY) {

View file

@ -133,7 +133,7 @@ public class ZapperScreen extends AbstractSimiScreen {
protected void renderZapper(MatrixStack matrixStack) {
GuiGameElement.of(zapper)
.at((this.width - this.sWidth) / 2 + 200, this.height / 2 - this.sHeight / 4 + 25, -150)//TODO
.at((this.width - this.sWidth) / 2 + 200, this.height / 2 - this.sHeight / 4 + 25, -150)
.scale(4)
.render(matrixStack);
}

View file

@ -35,6 +35,7 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
public class SchematicannonScreen extends AbstractSimiContainerScreen<SchematicannonContainer> {
private static final AllGuiTextures BG_BOTTOM = AllGuiTextures.SCHEMATICANNON_BOTTOM;
@ -375,12 +376,12 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
return tooltip;
}
float f = te.fuelLevel * 100;
tooltip.add(Lang.translate(_gunpowderLevel, "" + (int) f));
tooltip.add(Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft).formatted(GRAY)); // fixme
int fillPercent = (int) (te.fuelLevel * 100);
tooltip.add(Lang.translate(_gunpowderLevel, fillPercent));
tooltip.add(Lang.translate(_shotsRemaining, new StringTextComponent(Integer.toString(shotsLeft)).formatted(BLUE)).formatted(GRAY));
if (shotsLeftWithItems != shotsLeft)
tooltip
.add(Lang.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems).formatted(GRAY)); // fixme
tooltip.add(Lang.translate(_shotsRemainingWithBackup, new StringTextComponent(Integer.toString(shotsLeftWithItems)).formatted(BLUE)).formatted(GRAY));
return tooltip;
}

View file

@ -10,6 +10,7 @@ import net.minecraft.command.arguments.EntityArgument;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.play.server.SPlayerAbilitiesPacket;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
public class FlySpeedCommand {
@ -53,7 +54,8 @@ public class FlySpeedCommand {
private static int sendFlySpeedUpdate(CommandContext<CommandSource> ctx, ServerPlayerEntity player, float speed) {
SPlayerAbilitiesPacket packet = new SPlayerAbilitiesPacket(player.abilities);
//packet.setFlySpeed(speed);TODO 1.16
//packet.setFlySpeed(speed);
ObfuscationReflectionHelper.setPrivateValue(SPlayerAbilitiesPacket.class, packet, speed, "field_149116_e");
player.connection.sendPacket(packet);
ctx.getSource().sendFeedback(new StringTextComponent("Temporarily set " + player.getName().getString() + "'s Flying Speed to: " + speed), true);

View file

@ -86,7 +86,7 @@ public class PonderRegistry {
PonderStoryBoardEntry sb = entries.get(i);
Template activeTemplate = loadSchematic(sb.getSchematicName());
PonderWorld world = new PonderWorld(BlockPos.ZERO, Minecraft.getInstance().world);
activeTemplate.placeAndNotifyListeners(world, BlockPos.ZERO, new PlacementSettings(), world.rand);//TODO 1.16 crashing
activeTemplate.placeAndNotifyListeners(world, BlockPos.ZERO, new PlacementSettings(), world.rand);
world.createBackup();
PonderScene scene = compileScene(i, sb, world);
scene.begin();

View file

@ -461,7 +461,7 @@ public class PonderUI extends NavigatableSimiScreen {
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90));
ms.push();
ms.translate(0, 0, bounds.getZSize() * 16);
ms.multiply(Vector3f.NEGATIVE_X.getDegreesQuaternion(-90));
ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-90));
textRenderer.draw(ms, d.name().substring(0, 1), 0, 0, 0x66FFFFFF);
textRenderer.draw(ms, "|", 2, 10, 0x44FFFFFF);
textRenderer.draw(ms, ".", 2, 14, 0x22FFFFFF);

View file

@ -14,11 +14,13 @@ import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3i;
import net.minecraft.world.World;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@ -31,20 +33,29 @@ public interface IPlacementHelper {
BlockState ID = new BlockState(Blocks.AIR, null, null);
/**
* @return a predicate that gets tested with the items held in the players hands,
* @return a predicate that gets tested with the items held in the players hands<br>
* should return true if this placement helper is active with the given item
*/
Predicate<ItemStack> getItemPredicate();
/**
* @return a predicate that gets tested with the blockstate the player is looking at
* @return a predicate that gets tested with the blockstate the player is looking at<br>
* should return true if this placement helper is active with the given blockstate
*/
Predicate<BlockState> getStatePredicate();
/**
* @return PlacementOffset.fail() if no valid offset could be found.
* PlacementOffset.success(newPos) with newPos being the new position the block should be placed at
*
* @param player the player that activated the placement helper
* @param world the world that the placement helper got activated in
* @param state the Blockstate of the Block that the player is looking at or clicked on
* @param pos the position of the Block the player is looking at or clicked on
* @param ray the exact raytrace result
*
* @return the PlacementOffset object describing where to place the new block.<br>
* Use {@link PlacementOffset#fail} when no new position could be found.<br>
* Use {@link PlacementOffset#success(Vector3i)} with the new BlockPos to indicate a success
* and call {@link PlacementOffset#withTransform(Function)} if the blocks default state has to be modified before it is placed
*/
PlacementOffset getOffset(PlayerEntity player, World world, BlockState state, BlockPos pos, BlockRayTraceResult ray);
@ -58,7 +69,15 @@ public interface IPlacementHelper {
return offset;
}
//only gets called when placementOffset is successful
/**
* overwrite this method if your placement helper needs a different rendering than the default ghost state
*
* @param pos the position of the Block the player is looking at or clicked on
* @param state the Blockstate of the Block that the player is looking at or clicked on
* @param ray the exact raytrace result
* @param offset the PlacementOffset returned by {@link #getOffset(PlayerEntity, World, BlockState, BlockPos, BlockRayTraceResult)}<br>
* the offset will always be successful if this method is called
*/
default void renderAt(BlockPos pos, BlockState state, BlockRayTraceResult ray, PlacementOffset offset) {
displayGhost(offset);
}