Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Commit

Permalink
Port to Minecraft 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulvdberge committed Nov 16, 2020
1 parent 1a39350 commit a7638fc
Show file tree
Hide file tree
Showing 22 changed files with 155 additions and 145 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build
# other
eclipse
run
logs/

# Files from Forge MDK
forge*changelog.txt
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Refined Pipes Changelog

## 0.4.3
## 0.5
- Port to Minecraft 1.16 (raoulvdberge)
- Added Russian translation (KhottyManatee55)

## 0.4.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Refined Pipes [![Build Status](https://ci.refinedmods.com/buildStatus/icon?job=refinedpipes-mc1.15)](https://ci.refinedmods.com/job/refinedpipes-mc1.15/) [![CurseForge](http://cf.way2muchnoise.eu/full_370696_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/refined-pipes)
# Refined Pipes [![Build Status](https://ci.refinedmods.com/buildStatus/icon?job=refinedpipes-mc1.16)](https://ci.refinedmods.com/job/refinedpipes-mc1.16/) [![CurseForge](http://cf.way2muchnoise.eu/full_370696_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/refined-pipes)

Refined Pipes is a Minecraft mod that adds item, fluid and energy pipes.

Expand Down
19 changes: 8 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import java.nio.file.Files
import java.nio.file.Paths

buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
Expand All @@ -23,7 +20,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '0.4.3'
version = '0.5'
def env = System.getenv()
if (env.BUILD_NUMBER) {
version = version + "+" + "${env.BUILD_NUMBER}"
Expand All @@ -36,7 +33,7 @@ sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = co
compileJava.options.encoding = 'UTF-8'

minecraft {
mappings channel: 'snapshot', version: '20200225-1.15.1'
mappings channel: 'snapshot', version: '20200723-1.16.1'

runs {
client {
Expand Down Expand Up @@ -96,13 +93,13 @@ processResources {
}

dependencies {
minecraft 'net.minecraftforge:forge:1.15.2-31.1.39'
minecraft 'net.minecraftforge:forge:1.16.3-34.1.0'

runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2")
runtimeOnly fg.deobf("not_used:Mekanism-1.15.2:9.9.17.409")
runtimeOnly fg.deobf("com.github.mcjty:mcjtylib:1.15-4.0.3-alpha")
runtimeOnly fg.deobf("com.github.mcjty:rftoolsbase:1.15-1.0.1-alpha")
runtimeOnly fg.deobf("com.github.mcjty:rftoolspower:1.15-2.0.1-alpha")
runtimeOnly fg.deobf("mezz.jei:jei-1.16.3:7.3.2.36")
// runtimeOnly fg.deobf("not_used:Mekanism-1.15.2:9.9.17.409")
// runtimeOnly fg.deobf("com.github.mcjty:mcjtylib:1.15-4.0.3-alpha")
// runtimeOnly fg.deobf("com.github.mcjty:rftoolsbase:1.15-1.0.1-alpha")
// runtimeOnly fg.deobf("com.github.mcjty:rftoolspower:1.15-2.0.1-alpha")
}

jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void sendInArea(World world, BlockPos pos, int radius, Object message) {
pos.getY(),
pos.getZ(),
radius,
world.getDimension().getType()
world.func_234923_W_()
)), message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
Expand Down Expand Up @@ -212,7 +212,7 @@ public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockRea
}

@Nullable
public Direction getAttachmentDirectionClicked(BlockPos pos, Vec3d hit) {
public Direction getAttachmentDirectionClicked(BlockPos pos, Vector3d hit) {
if (Raytracer.inclusiveContains(PipeShapeProps.NORTH_ATTACHMENT_SHAPE.getBoundingBox().offset(pos), hit)) {
return Direction.NORTH;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import com.refinedmods.refinedpipes.util.StringUtil;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.*;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;

import javax.annotation.Nullable;
Expand All @@ -24,16 +27,16 @@ public EnergyPipeBlockItem(EnergyPipeBlock block) {
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);

tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).setStyle(new Style().setColor(TextFormatting.YELLOW)));
tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).mergeStyle(TextFormatting.YELLOW));

tooltip.add(new TranslationTextComponent(
"tooltip.refinedpipes.energy_pipe.capacity",
new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " FE").setStyle(new Style().setColor(TextFormatting.WHITE))
).setStyle(new Style().setColor(TextFormatting.GRAY)));
new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " FE").mergeStyle(TextFormatting.WHITE)
).mergeStyle(TextFormatting.GRAY));

tooltip.add(new TranslationTextComponent(
"tooltip.refinedpipes.energy_pipe.transfer_rate",
new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " FE/t").setStyle(new Style().setColor(TextFormatting.WHITE))
).setStyle(new Style().setColor(TextFormatting.GRAY)));
new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " FE/t").mergeStyle(TextFormatting.WHITE)
).mergeStyle(TextFormatting.GRAY));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import com.refinedmods.refinedpipes.util.StringUtil;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.*;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;

import javax.annotation.Nullable;
Expand All @@ -24,16 +27,16 @@ public FluidPipeBlockItem(FluidPipeBlock block) {
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);

tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).setStyle(new Style().setColor(TextFormatting.YELLOW)));
tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).mergeStyle(TextFormatting.YELLOW));

tooltip.add(new TranslationTextComponent(
"tooltip.refinedpipes.fluid_pipe.capacity",
new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " mB").setStyle(new Style().setColor(TextFormatting.WHITE))
).setStyle(new Style().setColor(TextFormatting.GRAY)));
new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " mB").mergeStyle(TextFormatting.WHITE)
).mergeStyle(TextFormatting.GRAY));

tooltip.add(new TranslationTextComponent(
"tooltip.refinedpipes.fluid_pipe.transfer_rate",
new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " mB/t").setStyle(new Style().setColor(TextFormatting.WHITE))
).setStyle(new Style().setColor(TextFormatting.GRAY)));
new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " mB/t").mergeStyle(TextFormatting.WHITE)
).mergeStyle(TextFormatting.GRAY));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import com.refinedmods.refinedpipes.network.pipe.item.ItemPipeType;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.*;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;

import javax.annotation.Nullable;
Expand All @@ -23,11 +26,11 @@ public ItemPipeBlockItem(ItemPipeBlock block) {
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);

tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).setStyle(new Style().setColor(TextFormatting.YELLOW)));
tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).mergeStyle(TextFormatting.YELLOW));

tooltip.add(new TranslationTextComponent(
"tooltip.refinedpipes.item_pipe.speed",
new StringTextComponent(type.getSpeedComparedToBasicTier() + "%").setStyle(new Style().setColor(TextFormatting.WHITE))
).setStyle(new Style().setColor(TextFormatting.GRAY)));
new StringTextComponent(type.getSpeedComparedToBasicTier() + "%").mergeStyle(TextFormatting.WHITE)
).mergeStyle(TextFormatting.GRAY));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public static NetworkManager get(World world) {
}

public static NetworkManager get(ServerWorld world) {
String name = NAME + "_" + world.getDimension().getType().getRegistryName().getNamespace() + "_" + world.getDimension().getType().getRegistryName().getPath();

return world.getSavedData().getOrCreate(() -> new NetworkManager(name, world), name);
return world.getSavedData().getOrCreate(() -> new NetworkManager(NAME, world), NAME);
}

private final World world;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.*;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;

import java.util.List;

Expand Down Expand Up @@ -85,41 +88,41 @@ public ResourceLocation getModelLocation() {

@Override
public void addInformation(List<ITextComponent> tooltip) {
tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).setStyle(new Style().setColor(TextFormatting.YELLOW)));
tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).mergeStyle(TextFormatting.YELLOW));

ITextComponent itemsToExtract = new StringTextComponent(StringUtil.formatNumber(type.getItemsToExtract()) + " ")
.appendSibling(new TranslationTextComponent("misc.refinedpipes.item" + (type.getItemsToExtract() == 1 ? "" : "s")))
.setStyle(new Style().setColor(TextFormatting.WHITE));
.append(new TranslationTextComponent("misc.refinedpipes.item" + (type.getItemsToExtract() == 1 ? "" : "s")))
.mergeStyle(TextFormatting.WHITE);

float itemSecondsInterval = type.getItemTickInterval() / 20F;
ITextComponent itemTickInterval = new StringTextComponent(StringUtil.formatNumber(itemSecondsInterval) + " ")
.appendSibling(new TranslationTextComponent("misc.refinedpipes.second" + (itemSecondsInterval == 1 ? "" : "s")))
.setStyle(new Style().setColor(TextFormatting.WHITE));
.append(new TranslationTextComponent("misc.refinedpipes.second" + (itemSecondsInterval == 1 ? "" : "s")))
.mergeStyle(TextFormatting.WHITE);

tooltip.add(new TranslationTextComponent(
"tooltip.refinedpipes.extractor_attachment.item_extraction_rate",
itemsToExtract,
itemTickInterval
).setStyle(new Style().setColor(TextFormatting.GRAY)));
).mergeStyle(TextFormatting.GRAY));

ITextComponent fluidsToExtract = new StringTextComponent(StringUtil.formatNumber(type.getFluidsToExtract()) + " mB")
.setStyle(new Style().setColor(TextFormatting.WHITE));
.mergeStyle(TextFormatting.WHITE);

float fluidSecondsInterval = type.getFluidTickInterval() / 20F;
ITextComponent fluidTickInterval = new StringTextComponent(StringUtil.formatNumber(fluidSecondsInterval) + " ")
.appendSibling(new TranslationTextComponent("misc.refinedpipes.second" + (fluidSecondsInterval == 1 ? "" : "s")))
.setStyle(new Style().setColor(TextFormatting.WHITE));
.append(new TranslationTextComponent("misc.refinedpipes.second" + (fluidSecondsInterval == 1 ? "" : "s")))
.mergeStyle(TextFormatting.WHITE);

tooltip.add(new TranslationTextComponent(
"tooltip.refinedpipes.extractor_attachment.fluid_extraction_rate",
fluidsToExtract,
fluidTickInterval
).setStyle(new Style().setColor(TextFormatting.GRAY)));
).mergeStyle(TextFormatting.GRAY));

tooltip.add(new TranslationTextComponent(
"tooltip.refinedpipes.extractor_attachment.filter_slots",
new StringTextComponent("" + type.getFilterSlots()).setStyle(new Style().setColor(TextFormatting.WHITE))
).setStyle(new Style().setColor(TextFormatting.GRAY)));
new StringTextComponent("" + type.getFilterSlots()).mergeStyle(TextFormatting.WHITE)
).mergeStyle(TextFormatting.GRAY));

addAbilityToInformation(tooltip, type.getCanSetRedstoneMode(), "misc.refinedpipes.redstone_mode");
addAbilityToInformation(tooltip, type.getCanSetWhitelistBlacklist(), "misc.refinedpipes.mode");
Expand All @@ -129,8 +132,8 @@ public void addInformation(List<ITextComponent> tooltip) {

private void addAbilityToInformation(List<ITextComponent> tooltip, boolean possible, String key) {
tooltip.add(
new StringTextComponent(possible ? "✓ " : "❌ ").appendSibling(new TranslationTextComponent(key))
.setStyle(new Style().setColor(possible ? TextFormatting.GREEN : TextFormatting.RED))
new StringTextComponent(possible ? "✓ " : "❌ ").append(new TranslationTextComponent(key))
.mergeStyle(possible ? TextFormatting.GREEN : TextFormatting.RED)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IBlockReader;
import org.apache.commons.lang3.tuple.Pair;

Expand Down Expand Up @@ -64,7 +64,7 @@ private VoxelShape addFakeAttachmentShape(Block block, BlockPos pos, Entity enti
return shape;
}

Pair<Vec3d, Vec3d> vec = Raytracer.getVectors(entity);
Pair<Vector3d, Vector3d> vec = Raytracer.getVectors(entity);

Raytracer.AdvancedRayTraceResult<BlockRayTraceResult> result = Raytracer.collisionRayTrace(pos, vec.getLeft(), vec.getRight(), attachmentShapes);
if (result != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.Quaternion;

public class ItemPipeTileEntityRenderer extends TileEntityRenderer<ItemPipeTileEntity> {
public ItemPipeTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package com.refinedmods.refinedpipes.render;

import com.google.common.collect.ImmutableList;

import com.refinedmods.refinedpipes.block.PipeBlock;
import com.refinedmods.refinedpipes.tile.PipeTileEntity;

import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
package com.refinedmods.refinedpipes.screen;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedpipes.container.BaseContainer;
import com.refinedmods.refinedpipes.container.slot.FluidFilterSlot;
import com.refinedmods.refinedpipes.render.FluidRenderer;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.ITextProperties;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.client.gui.GuiUtils;

import java.util.ArrayList;
import java.util.List;

public abstract class BaseScreen<T extends BaseContainer> extends ContainerScreen<T> {
private final List<String> fluidTooltip = new ArrayList<>(1);
private final List<ITextProperties> fluidTooltip = new ArrayList<>(1);

public BaseScreen(T screenContainer, PlayerInventory inv, ITextComponent title) {
super(screenContainer, inv, title);

fluidTooltip.add("");
fluidTooltip.add(StringTextComponent.EMPTY);
}

@Override
protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

for (FluidFilterSlot slot : container.getFluidSlots()) {
Expand All @@ -37,9 +40,7 @@ protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mou
}

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);

protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int mouseX, int mouseY) {
for (FluidFilterSlot slot : container.getFluidSlots()) {
FluidStack stack = slot.getFluidInventory().getFluid(slot.getSlotIndex());
if (stack.isEmpty()) {
Expand All @@ -50,9 +51,9 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
continue;
}

fluidTooltip.set(0, stack.getDisplayName().getFormattedText());
fluidTooltip.set(0, stack.getDisplayName());

GuiUtils.drawHoveringText(fluidTooltip, mouseX - guiLeft, mouseY - guiTop, width, height, -1, font);
GuiUtils.drawHoveringText(matrixStack, fluidTooltip, mouseX - guiLeft, mouseY - guiTop, width, height, -1, font);
}
}
}
Loading

0 comments on commit a7638fc

Please sign in to comment.