mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 02:43:42 +01:00
even more porty?
This commit is contained in:
parent
fe92f8fb41
commit
f01aeee43e
20 changed files with 167 additions and 149 deletions
|
@ -1004,7 +1004,7 @@ public class AllBlocks {
|
|||
.register();
|
||||
|
||||
public static final BlockEntry<OxidizingBlock> COPPER_BLOCK =
|
||||
REGISTRATE.block("copper_block", p -> new OxidizingBlock(p, 1 / 32f, true))
|
||||
REGISTRATE.block("copper_block", p -> new OxidizingBlock(p, 1 / 32f))
|
||||
.initialProperties(() -> Blocks.IRON_BLOCK)
|
||||
.transform(tagBlockAndItem("storage_blocks/copper"))
|
||||
.transform(oxidizedItemModel())
|
||||
|
@ -1027,14 +1027,14 @@ public class AllBlocks {
|
|||
.transform(oxidizedBlockstate())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<MetalBlock> ZINC_BLOCK = REGISTRATE.block("zinc_block", p -> new MetalBlock(p, true))
|
||||
public static final BlockEntry<Block> ZINC_BLOCK = REGISTRATE.block("zinc_block", p -> new Block(p))
|
||||
.initialProperties(() -> Blocks.IRON_BLOCK)
|
||||
.transform(tagBlockAndItem("storage_blocks/zinc"))
|
||||
.build()
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<MetalBlock> BRASS_BLOCK =
|
||||
REGISTRATE.block("brass_block", p -> new MetalBlock(p, true))
|
||||
public static final BlockEntry<Block> BRASS_BLOCK =
|
||||
REGISTRATE.block("brass_block", p -> new Block(p))
|
||||
.initialProperties(() -> Blocks.IRON_BLOCK)
|
||||
.transform(tagBlockAndItem("storage_blocks/brass"))
|
||||
.build()
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.simibubi.create.foundation.utility.FilesHelper;
|
|||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -31,7 +32,7 @@ public class ClientSchematicLoader {
|
|||
|
||||
public static final int PACKET_DELAY = 10;
|
||||
|
||||
private List<String> availableSchematics;
|
||||
private List<ITextComponent> availableSchematics;
|
||||
private Map<String, InputStream> activeUploads;
|
||||
private int packetCycle;
|
||||
|
||||
|
@ -68,10 +69,8 @@ public class ClientSchematicLoader {
|
|||
// Too big
|
||||
Integer maxSize = AllConfigs.SERVER.schematics.maxTotalSchematicSize.get();
|
||||
if (size > maxSize * 1000) {
|
||||
Minecraft.getInstance().player.sendMessage(new StringTextComponent(
|
||||
Lang.translate("schematics.uploadTooLarge") + " (" + size / 1000 + " KB)."));
|
||||
Minecraft.getInstance().player.sendMessage(
|
||||
new StringTextComponent(Lang.translate("schematics.maxAllowedSize") + " " + maxSize + " KB"));
|
||||
Minecraft.getInstance().player.sendMessage(Lang.translate("schematics.uploadTooLarge").append(" (" + size / 1000 + " KB)."), Minecraft.getInstance().player.getUniqueID());
|
||||
Minecraft.getInstance().player.sendMessage(Lang.translate("schematics.maxAllowedSize").append(" " + maxSize + " KB"), Minecraft.getInstance().player.getUniqueID());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -126,7 +125,7 @@ public class ClientSchematicLoader {
|
|||
if (Files.isDirectory(path))
|
||||
return;
|
||||
|
||||
availableSchematics.add(path.getFileName().toString());
|
||||
availableSchematics.add(ITextComponent.of(path.getFileName().toString()));
|
||||
});
|
||||
} catch (NoSuchFileException e) {
|
||||
// No Schematics created yet
|
||||
|
@ -136,7 +135,7 @@ public class ClientSchematicLoader {
|
|||
|
||||
}
|
||||
|
||||
public List<String> getAvailableSchematics() {
|
||||
public List<ITextComponent> getAvailableSchematics() {
|
||||
return availableSchematics;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
|
@ -49,7 +50,7 @@ public class ItemRequirement {
|
|||
Item item = BlockItem.BLOCK_TO_ITEM.getOrDefault(state.getBlock(), Items.AIR);
|
||||
|
||||
// double slab needs two items
|
||||
if (state.has(BlockStateProperties.SLAB_TYPE) && state.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE)
|
||||
if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.SLAB_TYPE) && state.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE)
|
||||
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, 2)));
|
||||
if (block instanceof TurtleEggBlock)
|
||||
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.get(TurtleEggBlock.EGGS).intValue())));
|
||||
|
|
|
@ -91,9 +91,9 @@ public class MaterialChecklist {
|
|||
Collections.sort(keys, (item1, item2) -> {
|
||||
Locale locale = Locale.ENGLISH;
|
||||
String name1 =
|
||||
new TranslationTextComponent(((Item) item1).getTranslationKey()).getFormattedText().toLowerCase(locale);
|
||||
new TranslationTextComponent(item1.getTranslationKey()).getFormattedText().toLowerCase(locale);
|
||||
String name2 =
|
||||
new TranslationTextComponent(((Item) item2).getTranslationKey()).getFormattedText().toLowerCase(locale);
|
||||
new TranslationTextComponent(item2.getTranslationKey()).getFormattedText().toLowerCase(locale);
|
||||
return name1.compareTo(name2);
|
||||
});
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -24,14 +25,11 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MutableBoundingBox;
|
||||
import net.minecraft.world.EmptyTickList;
|
||||
import net.minecraft.world.ITickList;
|
||||
import net.minecraft.world.LightType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.*;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
|
||||
public class SchematicWorld extends WrappedWorld {
|
||||
public class SchematicWorld extends WrappedWorld implements IServerWorld {
|
||||
|
||||
private Map<BlockPos, BlockState> blocks;
|
||||
private Map<BlockPos, TileEntity> tileEntities;
|
||||
|
@ -102,7 +100,7 @@ public class SchematicWorld extends WrappedWorld {
|
|||
return Blocks.GRASS_BLOCK.getDefaultState();
|
||||
if (getBounds().isVecInside(pos) && blocks.containsKey(pos)) {
|
||||
BlockState blockState = blocks.get(pos);
|
||||
if (blockState.has(BlockStateProperties.LIT))
|
||||
if (BlockHelper.hasBlockStateProperty(blockState, BlockStateProperties.LIT))
|
||||
blockState = blockState.with(BlockStateProperties.LIT, false);
|
||||
return blockState;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.content.schematics.block;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.CreateClient;
|
||||
|
@ -18,7 +19,9 @@ import net.minecraft.entity.player.PlayerInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
@ -35,11 +38,11 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
private IconButton refreshButton;
|
||||
private Label schematicsLabel;
|
||||
|
||||
private final String title = Lang.translate("gui.schematicTable.title");
|
||||
private final String uploading = Lang.translate("gui.schematicTable.uploading");
|
||||
private final String finished = Lang.translate("gui.schematicTable.finished");
|
||||
private final String noSchematics = Lang.translate("gui.schematicTable.noSchematics");
|
||||
private final String availableSchematicsTitle = Lang.translate("gui.schematicTable.availableSchematics");
|
||||
private final ITextComponent title = Lang.translate("gui.schematicTable.title");
|
||||
private final ITextComponent uploading = Lang.translate("gui.schematicTable.uploading");
|
||||
private final ITextComponent finished = Lang.translate("gui.schematicTable.finished");
|
||||
private final ITextComponent noSchematics = Lang.translate("gui.schematicTable.noSchematics");
|
||||
private final ITextComponent availableSchematicsTitle = Lang.translate("gui.schematicTable.availableSchematics");
|
||||
private final ItemStack renderedItem = AllBlocks.SCHEMATIC_TABLE.asStack();
|
||||
|
||||
private float progress;
|
||||
|
@ -61,14 +64,14 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
int mainTop = guiTop - 16;
|
||||
|
||||
CreateClient.schematicSender.refresh();
|
||||
List<String> availableSchematics = CreateClient.schematicSender.getAvailableSchematics();
|
||||
List<ITextComponent> availableSchematics = CreateClient.schematicSender.getAvailableSchematics();
|
||||
|
||||
schematicsLabel = new Label(mainLeft + 36, mainTop + 26, "").withShadow();
|
||||
schematicsLabel.text = "";
|
||||
schematicsLabel.text = StringTextComponent.EMPTY;
|
||||
if (!availableSchematics.isEmpty()) {
|
||||
schematicsArea =
|
||||
new SelectionScrollInput(mainLeft + 33, mainTop + 23, 134, 14).forOptions(availableSchematics)
|
||||
.titled(availableSchematicsTitle)
|
||||
.titled(availableSchematicsTitle.copy())
|
||||
.writingTo(schematicsLabel);
|
||||
widgets.add(schematicsArea);
|
||||
widgets.add(schematicsLabel);
|
||||
|
@ -83,13 +86,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
|
||||
int x = guiLeft + 20;
|
||||
int y = guiTop;
|
||||
|
@ -98,32 +95,31 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
int mainTop = guiTop - 16;
|
||||
|
||||
AllGuiTextures.PLAYER_INVENTORY.draw(this, x - 16, y + 70 + 14);
|
||||
font.drawString(playerInventory.getDisplayName()
|
||||
.getFormattedText(), x - 15 + 7, y + 64 + 26, 0x666666);
|
||||
textRenderer.draw(matrixStack, playerInventory.getDisplayName(), x - 15 + 7, y + 64 + 26, 0x666666);
|
||||
|
||||
SCHEMATIC_TABLE.draw(this, mainLeft, mainTop);
|
||||
|
||||
if (container.getTileEntity().isUploading)
|
||||
font.drawString(uploading, mainLeft + 76, mainTop + 10, AllGuiTextures.FONT_COLOR);
|
||||
textRenderer.draw(matrixStack, uploading, mainLeft + 76, mainTop + 10, AllGuiTextures.FONT_COLOR);
|
||||
else if (container.getSlot(1).getHasStack())
|
||||
font.drawString(finished, mainLeft + 60, mainTop + 10, AllGuiTextures.FONT_COLOR);
|
||||
textRenderer.draw(matrixStack, finished, mainLeft + 60, mainTop + 10, AllGuiTextures.FONT_COLOR);
|
||||
else
|
||||
font.drawString(title, mainLeft + 60, mainTop + 10, AllGuiTextures.FONT_COLOR);
|
||||
if (schematicsArea == null)
|
||||
font.drawStringWithShadow(noSchematics, mainLeft + 39, mainTop + 26, 0xFFDD44);
|
||||
textRenderer.draw(matrixStack, title, mainLeft + 60, mainTop + 10, AllGuiTextures.FONT_COLOR);
|
||||
if (schematicsArea == null)
|
||||
textRenderer.drawWithShadow(matrixStack, noSchematics, mainLeft + 39, mainTop + 26, 0xFFDD44);
|
||||
|
||||
GuiGameElement.of(renderedItem)
|
||||
.at(mainLeft + 217, mainTop + 48)
|
||||
.scale(3)
|
||||
.render();
|
||||
|
||||
minecraft.getTextureManager()
|
||||
client.getTextureManager()
|
||||
.bindTexture(SCHEMATIC_TABLE_PROGRESS.location);
|
||||
int width = (int) (SCHEMATIC_TABLE_PROGRESS.width
|
||||
* MathHelper.lerp(partialTicks, lastChasingProgress, chasingProgress));
|
||||
int height = SCHEMATIC_TABLE_PROGRESS.height;
|
||||
RenderSystem.disableLighting();
|
||||
drawTexture(mainLeft + 94, mainTop + 56, SCHEMATIC_TABLE_PROGRESS.startX, SCHEMATIC_TABLE_PROGRESS.startY, width,
|
||||
drawTexture(matrixStack, mainLeft + 94, mainTop + 56, SCHEMATIC_TABLE_PROGRESS.startX, SCHEMATIC_TABLE_PROGRESS.startY, width,
|
||||
height);
|
||||
|
||||
}
|
||||
|
@ -146,7 +142,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
|
||||
if (schematicsLabel != null) {
|
||||
schematicsLabel.colored(0xCCDDFF);
|
||||
schematicsLabel.text = container.getTileEntity().uploadingSchematic;
|
||||
schematicsLabel.text = ITextComponent.of(container.getTileEntity().uploadingSchematic);
|
||||
}
|
||||
if (schematicsArea != null)
|
||||
schematicsArea.visible = false;
|
||||
|
@ -173,9 +169,9 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
&& schematicsArea != null) {
|
||||
|
||||
lastChasingProgress = chasingProgress = progress = 0;
|
||||
List<String> availableSchematics = schematicSender.getAvailableSchematics();
|
||||
String schematic = availableSchematics.get(schematicsArea.getState());
|
||||
schematicSender.startNewUpload(schematic);
|
||||
List<ITextComponent> availableSchematics = schematicSender.getAvailableSchematics();
|
||||
ITextComponent schematic = availableSchematics.get(schematicsArea.getState());
|
||||
schematicSender.startNewUpload(schematic.getUnformattedComponentText());
|
||||
}
|
||||
|
||||
if (folderButton.isHovered()) {
|
||||
|
@ -186,18 +182,18 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
|
||||
if (refreshButton.isHovered()) {
|
||||
schematicSender.refresh();
|
||||
List<String> availableSchematics = schematicSender.getAvailableSchematics();
|
||||
List<ITextComponent> availableSchematics = schematicSender.getAvailableSchematics();
|
||||
widgets.remove(schematicsArea);
|
||||
|
||||
if (!availableSchematics.isEmpty()) {
|
||||
schematicsArea = new SelectionScrollInput(guiLeft - 56 + 33, guiTop - 16 + 23, 134, 14)
|
||||
.forOptions(availableSchematics)
|
||||
.titled(availableSchematicsTitle)
|
||||
.titled(availableSchematicsTitle.copy())
|
||||
.writingTo(schematicsLabel);
|
||||
widgets.add(schematicsArea);
|
||||
} else {
|
||||
schematicsArea = null;
|
||||
schematicsLabel.text = "";
|
||||
schematicsLabel.text = StringTextComponent.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.content.schematics.block;
|
|||
|
||||
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
|
@ -48,14 +49,14 @@ public class SchematicTableTileEntity extends SyncedTileEntity implements ITicka
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundNBT compound) {
|
||||
public void fromTag(BlockState state, CompoundNBT compound) {
|
||||
inventory.deserializeNBT(compound.getCompound("Inventory"));
|
||||
readClientUpdate(compound);
|
||||
super.read(compound);
|
||||
readClientUpdate(state, compound);
|
||||
super.fromTag(state, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readClientUpdate(CompoundNBT compound) {
|
||||
public void readClientUpdate(BlockState state, CompoundNBT compound) {
|
||||
if (compound.contains("Uploading")) {
|
||||
isUploading = true;
|
||||
uploadingSchematic = compound.getString("Schematic");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.schematics.block;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.schematics.packet.ConfigureSchematicannonPacket;
|
||||
import com.simibubi.create.content.schematics.packet.ConfigureSchematicannonPacket.Option;
|
||||
|
@ -19,6 +20,7 @@ import net.minecraft.client.gui.widget.Widget;
|
|||
import net.minecraft.client.renderer.Rectangle2d;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
|
@ -48,15 +50,15 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
|
||||
private List<Rectangle2d> extraAreas;
|
||||
|
||||
private final String title = Lang.translate("gui.schematicannon.title");
|
||||
private final String settingsTitle = Lang.translate("gui.schematicannon.settingsTitle");
|
||||
private final String listPrinter = Lang.translate("gui.schematicannon.listPrinter");
|
||||
private final ITextComponent title = Lang.translate("gui.schematicannon.title");
|
||||
private final ITextComponent settingsTitle = Lang.translate("gui.schematicannon.settingsTitle");
|
||||
private final ITextComponent listPrinter = Lang.translate("gui.schematicannon.listPrinter");
|
||||
private final String _gunpowderLevel = "gui.schematicannon.gunpowderLevel";
|
||||
private final String _shotsRemaining = "gui.schematicannon.shotsRemaining";
|
||||
private final String _shotsRemainingWithBackup = "gui.schematicannon.shotsRemainingWithBackup";
|
||||
|
||||
private final String optionEnabled = Lang.translate("gui.schematicannon.optionEnabled");
|
||||
private final String optionDisabled = Lang.translate("gui.schematicannon.optionDisabled");
|
||||
private final ITextComponent optionEnabled = Lang.translate("gui.schematicannon.optionEnabled");
|
||||
private final ITextComponent optionDisabled = Lang.translate("gui.schematicannon.optionDisabled");
|
||||
|
||||
private final ItemStack renderedItem = AllBlocks.SCHEMATICANNON.asStack();
|
||||
|
||||
|
@ -92,7 +94,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
List<AllIcons> icons = ImmutableList
|
||||
.of(AllIcons.I_DONT_REPLACE, AllIcons.I_REPLACE_SOLID, AllIcons.I_REPLACE_ANY,
|
||||
AllIcons.I_REPLACE_EMPTY);
|
||||
List<String> toolTips = ImmutableList
|
||||
List<ITextComponent> toolTips = ImmutableList
|
||||
.of(Lang.translate("gui.schematicannon.option.dontReplaceSolid"),
|
||||
Lang.translate("gui.schematicannon.option.replaceWithSolid"),
|
||||
Lang.translate("gui.schematicannon.option.replaceWithAny"),
|
||||
|
@ -190,8 +192,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
if (!button.isHovered())
|
||||
return;
|
||||
boolean enabled = indicator.state == State.ON;
|
||||
List<String> tip = button.getToolTip();
|
||||
tip.add(TextFormatting.BLUE + (enabled ? optionEnabled : optionDisabled));
|
||||
List<ITextComponent> tip = button.getToolTip();
|
||||
tip.add((enabled ? optionEnabled : optionDisabled).copy().formatted(TextFormatting.BLUE));
|
||||
tip
|
||||
.addAll(TooltipHelper
|
||||
.cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), GRAY,
|
||||
|
@ -199,14 +201,14 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
AllGuiTextures.PLAYER_INVENTORY.draw(this, guiLeft - 10, guiTop + 145);
|
||||
AllGuiTextures.SCHEMATICANNON_BG.draw(this, guiLeft + 20, guiTop);
|
||||
|
||||
SchematicannonTileEntity te = container.getTileEntity();
|
||||
renderPrintingProgress(te.schematicProgress);
|
||||
renderFuelBar(te.fuelLevel);
|
||||
renderChecklistPrinterProgress(te.bookPrintingProgress);
|
||||
renderPrintingProgress(matrixStack, te.schematicProgress);
|
||||
renderFuelBar(matrixStack, te.fuelLevel);
|
||||
renderChecklistPrinterProgress(matrixStack, te.bookPrintingProgress);
|
||||
|
||||
if (!te.inventory.getStackInSlot(0).isEmpty())
|
||||
renderBlueprintHighlight();
|
||||
|
@ -217,21 +219,21 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
.render();
|
||||
|
||||
|
||||
font.drawString(title, guiLeft + 80, guiTop + 10, AllGuiTextures.FONT_COLOR);
|
||||
textRenderer.draw(matrixStack, title, guiLeft + 80, guiTop + 10, AllGuiTextures.FONT_COLOR);
|
||||
|
||||
String msg = Lang.translate("schematicannon.status." + te.statusMsg);
|
||||
int stringWidth = font.getStringWidth(msg);
|
||||
IFormattableTextComponent msg = Lang.translate("schematicannon.status." + te.statusMsg);
|
||||
int stringWidth = textRenderer.getWidth(msg);
|
||||
|
||||
if (te.missingItem != null) {
|
||||
stringWidth += 15;
|
||||
itemRenderer.renderItemIntoGUI(te.missingItem, guiLeft + 145, guiTop + 25);
|
||||
}
|
||||
|
||||
font.drawStringWithShadow(msg, guiLeft + 20 + 96 - stringWidth / 2, guiTop + 30, 0xCCDDFF);
|
||||
textRenderer.drawWithShadow(matrixStack, msg, guiLeft + 20 + 96 - stringWidth / 2, guiTop + 30, 0xCCDDFF);
|
||||
|
||||
font.drawString(settingsTitle, guiLeft + 20 + 13, guiTop + 84, AllGuiTextures.FONT_COLOR);
|
||||
font
|
||||
.drawString(playerInventory.getDisplayName().getFormattedText(), guiLeft - 10 + 7, guiTop + 145 + 6,
|
||||
textRenderer.draw(matrixStack, settingsTitle, guiLeft + 20 + 13, guiTop + 84, AllGuiTextures.FONT_COLOR);
|
||||
textRenderer
|
||||
.draw(matrixStack, playerInventory.getDisplayName(), guiLeft - 10 + 7, guiTop + 145 + 6,
|
||||
0x666666);
|
||||
|
||||
// to see or debug the bounds of the extra area uncomment the following lines
|
||||
|
@ -244,34 +246,34 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
AllGuiTextures.SCHEMATICANNON_HIGHLIGHT.draw(this, guiLeft + 20 + 8, guiTop + 31);
|
||||
}
|
||||
|
||||
protected void renderPrintingProgress(float progress) {
|
||||
protected void renderPrintingProgress(MatrixStack matrixStack, float progress) {
|
||||
progress = Math.min(progress, 1);
|
||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_PROGRESS;
|
||||
minecraft.getTextureManager().bindTexture(sprite.location);
|
||||
drawTexture(guiLeft + 20 + 39, guiTop + 36, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
||||
client.getTextureManager().bindTexture(sprite.location);
|
||||
drawTexture(matrixStack, guiLeft + 20 + 39, guiTop + 36, sprite.startX, sprite.startY, (int) (sprite.width * progress),
|
||||
sprite.height);
|
||||
}
|
||||
|
||||
protected void renderChecklistPrinterProgress(float progress) {
|
||||
protected void renderChecklistPrinterProgress(MatrixStack matrixStack, float progress) {
|
||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_PROGRESS_2;
|
||||
minecraft.getTextureManager().bindTexture(sprite.location);
|
||||
drawTexture(guiLeft + 20 + 222, guiTop + 42, sprite.startX, sprite.startY, sprite.width,
|
||||
client.getTextureManager().bindTexture(sprite.location);
|
||||
drawTexture(matrixStack, guiLeft + 20 + 222, guiTop + 42, sprite.startX, sprite.startY, sprite.width,
|
||||
(int) (sprite.height * progress));
|
||||
}
|
||||
|
||||
protected void renderFuelBar(float amount) {
|
||||
protected void renderFuelBar(MatrixStack matrixStack, float amount) {
|
||||
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_FUEL;
|
||||
if (container.getTileEntity().hasCreativeCrate) {
|
||||
AllGuiTextures.SCHEMATICANNON_FUEL_CREATIVE.draw(this, guiLeft + 20 + 73, guiTop + 135);
|
||||
return;
|
||||
}
|
||||
minecraft.getTextureManager().bindTexture(sprite.location);
|
||||
drawTexture(guiLeft + 20 + 73, guiTop + 135, sprite.startX, sprite.startY, (int) (sprite.width * amount),
|
||||
client.getTextureManager().bindTexture(sprite.location);
|
||||
drawTexture(matrixStack, guiLeft + 20 + 73, guiTop + 135, sprite.startX, sprite.startY, (int) (sprite.width * amount),
|
||||
sprite.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindowForeground(int mouseX, int mouseY, float partialTicks) {
|
||||
protected void renderWindowForeground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
int fuelX = guiLeft + 20 + 73, fuelY = guiTop + 135;
|
||||
SchematicannonTileEntity te = container.getTileEntity();
|
||||
if (mouseX >= fuelX && mouseY >= fuelY && mouseX <= fuelX + AllGuiTextures.SCHEMATICANNON_FUEL.width
|
||||
|
@ -300,16 +302,16 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
int missingBlockX = guiLeft + 145, missingBlockY = guiTop + 25;
|
||||
if (mouseX >= missingBlockX && mouseY >= missingBlockY && mouseX <= missingBlockX + 16
|
||||
&& mouseY <= missingBlockY + 16) {
|
||||
renderTooltip(te.missingItem, mouseX, mouseY);
|
||||
renderTooltip(matrixStack, te.missingItem, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
int paperX = guiLeft + 20 + 202, paperY = guiTop + 20;
|
||||
if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16) {
|
||||
renderTooltip(listPrinter, mouseX, mouseY);
|
||||
renderTooltip(matrixStack, listPrinter, mouseX, mouseY);
|
||||
}
|
||||
|
||||
super.renderWindowForeground(mouseX, mouseY, partialTicks);
|
||||
super.renderWindowForeground(matrixStack, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -694,9 +694,9 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
boolean placingAir = state.getBlock() == Blocks.AIR;
|
||||
|
||||
BlockState toReplaceOther = null;
|
||||
if (state.has(BlockStateProperties.BED_PART) && state.has(BlockStateProperties.HORIZONTAL_FACING) && state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
|
||||
if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.BED_PART) && BlockHelper.hasBlockStateProperty(state, BlockStateProperties.HORIZONTAL_FACING) && state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
|
||||
toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING)));
|
||||
if (state.has(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||
if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER)
|
||||
toReplaceOther = world.getBlockState(pos.up());
|
||||
|
||||
|
@ -739,10 +739,10 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
return true;
|
||||
|
||||
// Block doesnt need to be placed twice (Doors, beds, double plants)
|
||||
if (state.has(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||
if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.UPPER)
|
||||
return true;
|
||||
if (state.has(BlockStateProperties.BED_PART) && state.get(BlockStateProperties.BED_PART) == BedPart.HEAD)
|
||||
if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.BED_PART) && state.get(BlockStateProperties.BED_PART) == BedPart.HEAD)
|
||||
return true;
|
||||
if (state.getBlock() instanceof PistonHeadBlock)
|
||||
return true;
|
||||
|
|
|
@ -207,7 +207,7 @@ public class SchematicAndQuillHandler {
|
|||
new BlockPos(bb.getXSize(), bb.getYSize(), bb.getZSize()), true, Blocks.AIR);
|
||||
|
||||
if (string.isEmpty())
|
||||
string = Lang.translate("schematicAndQuill.fallbackName");
|
||||
string = Lang.translate("schematicAndQuill.fallbackName").getUnformattedComponentText();
|
||||
|
||||
String folderPath = "schematics";
|
||||
FilesHelper.createFolderIfMissing(folderPath);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.schematics.client;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.CreateClient;
|
||||
|
@ -19,6 +20,9 @@ import net.minecraft.nbt.NBTUtil;
|
|||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.gen.feature.template.PlacementSettings;
|
||||
|
||||
public class SchematicEditScreen extends AbstractSimiScreen {
|
||||
|
@ -27,13 +31,13 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
private TextFieldWidget yInput;
|
||||
private TextFieldWidget zInput;
|
||||
|
||||
private final List<String> rotationOptions =
|
||||
private final List<ITextComponent> rotationOptions =
|
||||
Lang.translatedOptions("schematic.rotation", "none", "cw90", "cw180", "cw270");
|
||||
private final List<String> mirrorOptions =
|
||||
private final List<ITextComponent> mirrorOptions =
|
||||
Lang.translatedOptions("schematic.mirror", "none", "leftRight", "frontBack");
|
||||
private final String positionLabel = Lang.translate("schematic.position");
|
||||
private final String rotationLabel = Lang.translate("schematic.rotation");
|
||||
private final String mirrorLabel = Lang.translate("schematic.mirror");
|
||||
private final ITextComponent positionLabel = Lang.translate("schematic.position");
|
||||
private final ITextComponent rotationLabel = Lang.translate("schematic.rotation");
|
||||
private final ITextComponent mirrorLabel = Lang.translate("schematic.mirror");
|
||||
|
||||
private ScrollInput rotationArea;
|
||||
private ScrollInput mirrorArea;
|
||||
|
@ -46,9 +50,9 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
int y = guiTop;
|
||||
handler = CreateClient.schematicHandler;
|
||||
|
||||
xInput = new TextFieldWidget(font, x + 75, y + 32, 32, 10, "");
|
||||
yInput = new TextFieldWidget(font, x + 115, y + 32, 32, 10, "");
|
||||
zInput = new TextFieldWidget(font, x + 155, y + 32, 32, 10, "");
|
||||
xInput = new TextFieldWidget(textRenderer, x + 75, y + 32, 32, 10, StringTextComponent.EMPTY);
|
||||
yInput = new TextFieldWidget(textRenderer, x + 115, y + 32, 32, 10, StringTextComponent.EMPTY);
|
||||
zInput = new TextFieldWidget(textRenderer, x + 155, y + 32, 32, 10, StringTextComponent.EMPTY);
|
||||
|
||||
BlockPos anchor = handler.getTransformation().getAnchor();
|
||||
if (handler.isDeployed()) {
|
||||
|
@ -56,7 +60,7 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
yInput.setText("" + anchor.getY());
|
||||
zInput.setText("" + anchor.getZ());
|
||||
} else {
|
||||
BlockPos alt = minecraft.player.getPosition();
|
||||
BlockPos alt = client.player.getBlockPos();
|
||||
xInput.setText("" + alt.getX());
|
||||
yInput.setText("" + alt.getY());
|
||||
zInput.setText("" + alt.getZ());
|
||||
|
@ -82,11 +86,11 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
|
||||
PlacementSettings settings = handler.getTransformation().toSettings();
|
||||
Label labelR = new Label(x + 99, y + 52, "").withShadow();
|
||||
rotationArea = new SelectionScrollInput(x + 96, y + 49, 94, 14).forOptions(rotationOptions).titled("Rotation")
|
||||
rotationArea = new SelectionScrollInput(x + 96, y + 49, 94, 14).forOptions(rotationOptions).titled(new StringTextComponent("Rotation"))
|
||||
.setState(settings.getRotation().ordinal()).writingTo(labelR);
|
||||
|
||||
Label labelM = new Label(x + 99, y + 72, "").withShadow();
|
||||
mirrorArea = new SelectionScrollInput(x + 96, y + 69, 94, 14).forOptions(mirrorOptions).titled("Mirror")
|
||||
mirrorArea = new SelectionScrollInput(x + 96, y + 69, 94, 14).forOptions(mirrorOptions).titled(new StringTextComponent("Mirror"))
|
||||
.setState(settings.getMirror().ordinal()).writingTo(labelM);
|
||||
|
||||
Collections.addAll(widgets, xInput, yInput, zInput);
|
||||
|
@ -99,7 +103,7 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
public boolean keyPressed(int code, int p_keyPressed_2_, int p_keyPressed_3_) {
|
||||
|
||||
if (isPaste(code)) {
|
||||
String coords = minecraft.keyboardListener.getClipboardString();
|
||||
String coords = client.keyboardListener.getClipboardString();
|
||||
if (coords != null && !coords.isEmpty()) {
|
||||
coords.replaceAll(" ", "");
|
||||
String[] split = coords.split(",");
|
||||
|
@ -126,17 +130,17 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
||||
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
int x = guiLeft;
|
||||
int y = guiTop;
|
||||
AllGuiTextures.SCHEMATIC.draw(this, x, y);
|
||||
|
||||
font.drawStringWithShadow(handler.getCurrentSchematicName(),
|
||||
x + 103 - font.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 10, 0xDDEEFF);
|
||||
textRenderer.drawWithShadow(matrixStack, handler.getCurrentSchematicName(),
|
||||
x + 103 - textRenderer.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 10, 0xDDEEFF);
|
||||
|
||||
font.drawString(positionLabel, x + 10, y + 32, AllGuiTextures.FONT_COLOR);
|
||||
font.drawString(rotationLabel, x + 10, y + 52, AllGuiTextures.FONT_COLOR);
|
||||
font.drawString(mirrorLabel, x + 10, y + 72, AllGuiTextures.FONT_COLOR);
|
||||
textRenderer.draw(matrixStack, positionLabel, x + 10, y + 32, AllGuiTextures.FONT_COLOR);
|
||||
textRenderer.draw(matrixStack, rotationLabel, x + 10, y + 52, AllGuiTextures.FONT_COLOR);
|
||||
textRenderer.draw(matrixStack, mirrorLabel, x + 10, y + 72, AllGuiTextures.FONT_COLOR);
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(guiLeft + 220, guiTop + 20, 0);
|
||||
|
|
|
@ -127,11 +127,11 @@ public class SchematicHandler {
|
|||
SchematicWorld wMirroredLR = new SchematicWorld(clientWorld);
|
||||
PlacementSettings placementSettings = new PlacementSettings();
|
||||
|
||||
schematic.addBlocksToWorld(w, BlockPos.ZERO, placementSettings);
|
||||
schematic.place(w, BlockPos.ZERO, placementSettings);
|
||||
placementSettings.setMirror(Mirror.FRONT_BACK);
|
||||
schematic.addBlocksToWorld(wMirroredFB, BlockPos.ZERO.east(size.getX() - 1), placementSettings);
|
||||
schematic.place(wMirroredFB, BlockPos.ZERO.east(size.getX() - 1), placementSettings);
|
||||
placementSettings.setMirror(Mirror.LEFT_RIGHT);
|
||||
schematic.addBlocksToWorld(wMirroredLR, BlockPos.ZERO.south(size.getZ() - 1), placementSettings);
|
||||
schematic.place(wMirroredLR, BlockPos.ZERO.south(size.getZ() - 1), placementSettings);
|
||||
|
||||
renderers.get(0)
|
||||
.display(w);
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
public enum Tools {
|
||||
|
||||
|
@ -28,7 +29,7 @@ public enum Tools {
|
|||
return tool;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
public TranslationTextComponent getDisplayName() {
|
||||
return Lang.translate("schematic.tool." + Lang.asId(name()));
|
||||
}
|
||||
|
||||
|
@ -44,7 +45,7 @@ public enum Tools {
|
|||
return tools;
|
||||
}
|
||||
|
||||
public List<String> getDescription() {
|
||||
public List<TranslationTextComponent> getDescription() {
|
||||
return Lang.translatedOptions("schematic.tool." + Lang.asId(name()) + ".description", "0", "1", "2", "3");
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class SchematicItem extends Item {
|
|||
tooltip.add(new StringTextComponent(TextFormatting.GOLD + stack.getTag()
|
||||
.getString("File")));
|
||||
} else {
|
||||
tooltip.add(new StringTextComponent(TextFormatting.RED + Lang.translate("schematic.invalid")));
|
||||
tooltip.add(Lang.translate("schematic.invalid").formatted(TextFormatting.RED));
|
||||
}
|
||||
super.addInformation(stack, worldIn, tooltip, flagIn);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class SchematicPlacePacket extends SimplePacketBase {
|
|||
Template t = SchematicItem.loadSchematic(stack);
|
||||
PlacementSettings settings = SchematicItem.getSettings(stack);
|
||||
settings.setIgnoreEntities(false);
|
||||
t.addBlocksToWorld(player.getServerWorld(), NBTUtil.readBlockPos(stack.getTag().getCompound("Anchor")),
|
||||
t.place(player.getServerWorld(), NBTUtil.readBlockPos(stack.getTag().getCompound("Anchor")),
|
||||
settings);
|
||||
});
|
||||
context.get().setPacketHandled(true);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CommonEvents {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void serverStarted(FMLServerStartingEvent event) {
|
||||
AllCommands.register(event.getCommandDispatcher());
|
||||
AllCommands.register(event.getServer().getCommandManager().getDispatcher());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -2,6 +2,9 @@ package com.simibubi.create.foundation.gui;
|
|||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
@ -11,8 +14,8 @@ import net.minecraft.client.gui.widget.button.Button;
|
|||
|
||||
public class TextInputPromptScreen extends AbstractSimiScreen {
|
||||
|
||||
private final String defaultConfirm = Lang.translate("action.confirm");
|
||||
private final String defaultAbort = Lang.translate("action.abort");
|
||||
private final ITextComponent defaultConfirm = Lang.translate("action.confirm");
|
||||
private final ITextComponent defaultAbort = Lang.translate("action.abort");
|
||||
|
||||
private Consumer<String> callback;
|
||||
private Consumer<String> abortCallback;
|
||||
|
@ -21,9 +24,9 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
|
|||
private Button confirm;
|
||||
private Button abort;
|
||||
|
||||
private String buttonTextConfirm;
|
||||
private String buttonTextAbort;
|
||||
private String title;
|
||||
private ITextComponent buttonTextConfirm;
|
||||
private ITextComponent buttonTextAbort;
|
||||
private ITextComponent title;
|
||||
|
||||
private boolean confirmed;
|
||||
|
||||
|
@ -42,7 +45,7 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
|
|||
super.init();
|
||||
setWindowSize(AllGuiTextures.TEXT_INPUT.width, AllGuiTextures.TEXT_INPUT.height + 30);
|
||||
|
||||
this.nameField = new TextFieldWidget(font, guiLeft + 33, guiTop + 26, 128, 8, "");
|
||||
this.nameField = new TextFieldWidget(textRenderer, guiLeft + 33, guiTop + 26, 128, 8, StringTextComponent.EMPTY);
|
||||
this.nameField.setTextColor(-1);
|
||||
this.nameField.setDisabledTextColour(-1);
|
||||
this.nameField.setEnableBackgroundDrawing(false);
|
||||
|
@ -52,11 +55,11 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
|
|||
confirm = new Button(guiLeft - 5, guiTop + 50, 100, 20, buttonTextConfirm, button -> {
|
||||
callback.accept(nameField.getText());
|
||||
confirmed = true;
|
||||
minecraft.displayGuiScreen(null);
|
||||
client.displayGuiScreen(null);
|
||||
});
|
||||
|
||||
abort = new Button(guiLeft + 100, guiTop + 50, 100, 20, buttonTextAbort, button -> {
|
||||
minecraft.displayGuiScreen(null);
|
||||
client.displayGuiScreen(null);
|
||||
});
|
||||
|
||||
widgets.add(confirm);
|
||||
|
@ -65,9 +68,9 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
||||
public void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
AllGuiTextures.TEXT_INPUT.draw(this, guiLeft, guiTop);
|
||||
font.drawString(title, guiLeft + (sWidth / 2) - (font.getStringWidth(title) / 2), guiTop + 11,
|
||||
textRenderer.draw(matrixStack, title, guiLeft + (sWidth / 2) - (textRenderer.getWidth(title) / 2), guiTop + 11,
|
||||
AllGuiTextures.FONT_COLOR);
|
||||
}
|
||||
|
||||
|
@ -78,15 +81,15 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
|
|||
super.removed();
|
||||
}
|
||||
|
||||
public void setButtonTextConfirm(String buttonTextConfirm) {
|
||||
public void setButtonTextConfirm(ITextComponent buttonTextConfirm) {
|
||||
this.buttonTextConfirm = buttonTextConfirm;
|
||||
}
|
||||
|
||||
public void setButtonTextAbort(String buttonTextAbort) {
|
||||
public void setButtonTextAbort(ITextComponent buttonTextAbort) {
|
||||
this.buttonTextAbort = buttonTextAbort;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
public void setTitle(ITextComponent title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Locale;
|
|||
import com.simibubi.create.Create;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
public class Lang {
|
||||
|
@ -23,8 +24,8 @@ public class Lang {
|
|||
player.sendStatusMessage(createTranslationTextComponent(key, args), true);
|
||||
}
|
||||
|
||||
public static List<TranslationTextComponent> translatedOptions(String prefix, String... keys) {
|
||||
List<TranslationTextComponent> result = new ArrayList<>(keys.length);
|
||||
public static List<ITextComponent> translatedOptions(String prefix, String... keys) {
|
||||
List<ITextComponent> result = new ArrayList<>(keys.length);
|
||||
for (String key : keys) {
|
||||
result.add(translate(prefix + "." + key));
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -11,16 +12,23 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.crafting.RecipeManager;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
import net.minecraft.tags.NetworkTagManager;
|
||||
import net.minecraft.tags.ITagCollectionSupplier;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.DynamicRegistries;
|
||||
import net.minecraft.world.ITickList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.AbstractChunkProvider;
|
||||
import net.minecraft.world.storage.MapData;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
public class WrappedWorld extends World {
|
||||
|
||||
protected World world;
|
||||
|
@ -76,6 +84,11 @@ public class WrappedWorld extends World {
|
|||
return world.getPendingFluidTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkProvider getChunkProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEvent(PlayerEntity player, int type, BlockPos pos, int data) {}
|
||||
|
||||
|
@ -113,7 +126,7 @@ public class WrappedWorld extends World {
|
|||
|
||||
@Override
|
||||
public int getNextMapId() {
|
||||
return 0;
|
||||
return world.getNextMapId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -130,18 +143,22 @@ public class WrappedWorld extends World {
|
|||
}
|
||||
|
||||
@Override
|
||||
public NetworkTagManager getTags() {
|
||||
public ITagCollectionSupplier getTags() {
|
||||
return world.getTags();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return 256;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getGeneratorStoredBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_) {
|
||||
return world.getGeneratorStoredBiome(p_225604_1_, p_225604_2_, p_225604_3_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicRegistries getRegistryManager() {
|
||||
return world.getRegistryManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBrightness(Direction p_230487_1_, boolean p_230487_2_) {
|
||||
return world.getBrightness(p_230487_1_, p_230487_2_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.foundation.worldgen;
|
||||
|
||||
import com.simibubi.create.content.curiosities.tools.SandPaperItem;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -19,7 +20,7 @@ import java.util.LinkedList;
|
|||
import java.util.OptionalDouble;
|
||||
import java.util.Random;
|
||||
|
||||
public class OxidizingBlock extends MetalBlock {
|
||||
public class OxidizingBlock extends Block {
|
||||
|
||||
public static final IntegerProperty OXIDIZATION = IntegerProperty.create("oxidization", 0, 7);
|
||||
private float chance;
|
||||
|
@ -29,12 +30,6 @@ public class OxidizingBlock extends MetalBlock {
|
|||
this.chance = chance;
|
||||
setDefaultState(getDefaultState().with(OXIDIZATION, 0));
|
||||
}
|
||||
|
||||
public OxidizingBlock(Properties properties, float chance, boolean isBeaconBaseBlock) {
|
||||
super(properties, isBeaconBaseBlock);
|
||||
this.chance = chance;
|
||||
setDefaultState(getDefaultState().with(OXIDIZATION, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(Builder<Block, BlockState> builder) {
|
||||
|
@ -62,7 +57,7 @@ public class OxidizingBlock extends MetalBlock {
|
|||
if (neighborState.func_235903_d_(OXIDIZATION).map(ox -> ox != 0).orElse(false)) {
|
||||
neighbors.add(neighborState.get(OXIDIZATION));
|
||||
}
|
||||
if (Block.hasSolidSide(neighborState, worldIn, neighbourPos, facing.getOpposite())) {
|
||||
if (BlockHelper.hasBlockSolidSide(neighborState, worldIn, neighbourPos, facing.getOpposite())) {
|
||||
continue;
|
||||
}
|
||||
canIncrease = true;
|
||||
|
|
Loading…
Reference in a new issue