Compare commits

..

No commits in common. "e6f5b3b1c66668487231303dfcd87e0e1fe792b2" and "fcaedb3d5e56acdf82b53402c76494dff5ab02af" have entirely different histories.

14 changed files with 32 additions and 26 deletions

View file

@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.13.3'
version = '1.13.2'
group = 'de.ellpeck.prettypipes' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'PrettyPipes'
@ -105,11 +105,11 @@ configurations {
}
dependencies {
minecraft 'net.minecraftforge:forge:1.19-41.1.0'
minecraft 'net.minecraftforge:forge:1.19-41.0.45'
embed 'org.jgrapht:jgrapht-core:1.5.1'
compileOnly fg.deobf("mezz.jei:jei-1.19-common-api:11.1.1.239")
runtimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.1.1.239")
compileOnly fg.deobf("mezz.jei:jei-1.19-common-api:11.0.0.206")
runtimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.0.0.206")
// to test the rf requiring and crafting stuff
/* runtimeOnly fg.deobf("curse.maven:powah-352656:3057732")

View file

@ -170,7 +170,7 @@ public final class Registry {
event.register(ForgeRegistries.Keys.ENTITY_TYPES, h ->
h.register(new ResourceLocation(PrettyPipes.ID, "pipe_frame"), Registry.pipeFrameEntity = EntityType.Builder.<PipeFrameEntity>of(PipeFrameEntity::new, MobCategory.MISC).build("pipe_frame")));
event.register(ForgeRegistries.Keys.MENU_TYPES, h -> {
event.register(ForgeRegistries.Keys.CONTAINER_TYPES, h -> {
h.register(new ResourceLocation(PrettyPipes.ID, "pipe"), Registry.pipeContainer = IForgeMenuType.create((windowId, inv, data) -> new MainPipeContainer(Registry.pipeContainer, windowId, inv.player, data.readBlockPos())));
h.register(new ResourceLocation(PrettyPipes.ID, "item_terminal"), Registry.itemTerminalContainer = IForgeMenuType.create((windowId, inv, data) -> new ItemTerminalContainer(Registry.itemTerminalContainer, windowId, inv.player, data.readBlockPos())));
h.register(new ResourceLocation(PrettyPipes.ID, "crafting_terminal"), Registry.craftingTerminalContainer = IForgeMenuType.create((windowId, inv, data) -> new CraftingTerminalContainer(Registry.craftingTerminalContainer, windowId, inv.player, data.readBlockPos())));
@ -209,6 +209,7 @@ public final class Registry {
public static final class Client {
public static void setup(FMLClientSetupEvent event) {
ItemBlockRenderTypes.setRenderLayer(Registry.pipeBlock, RenderType.cutout());
BlockEntityRenderers.register(Registry.pipeBlockEntity, PipeRenderer::new);
EntityRenderers.register(Registry.pipeFrameEntity, PipeFrameRenderer::new);

View file

@ -69,7 +69,7 @@ public class JEIPrettyPipesPlugin implements IModPlugin {
}
@SubscribeEvent
public void onInitGui(ScreenEvent.Init.Post event) {
public void onInitGui(ScreenEvent.InitScreenEvent.Post event) {
var screen = event.getScreen();
if (!(screen instanceof ItemTerminalGui terminal))
return;
@ -84,15 +84,15 @@ public class JEIPrettyPipesPlugin implements IModPlugin {
}
@SubscribeEvent
public void onRenderGui(ScreenEvent.Render event) {
public void onRenderGui(ScreenEvent.DrawScreenEvent event) {
var screen = event.getScreen();
if (!(screen instanceof ItemTerminalGui terminal))
return;
var sync = PlayerPrefs.get().syncJei;
if (event instanceof ScreenEvent.Render.Post) {
if (event instanceof ScreenEvent.DrawScreenEvent.Post) {
if (this.jeiSyncButton.isHoveredOrFocused())
terminal.renderTooltip(event.getPoseStack(), Component.translatable("info." + PrettyPipes.ID + ".sync_jei." + (sync ? "on" : "off")), event.getMouseX(), event.getMouseY());
} else if (event instanceof ScreenEvent.Render.Pre) {
} else if (event instanceof ScreenEvent.DrawScreenEvent.Pre) {
this.jeiSyncButton.setMessage(Component.literal((sync ? ChatFormatting.GREEN : ChatFormatting.RED) + "J"));
}
}

View file

@ -118,7 +118,7 @@ public class WrenchItem extends Item {
}
@Override
public int getEnchantmentValue(ItemStack stack) {
public int getItemEnchantability(ItemStack stack) {
return 1;
}

View file

@ -79,10 +79,10 @@ public class PacketButton {
PIPE_TAB((pos, data, player) -> {
var tile = Utility.getBlockEntity(PipeBlockEntity.class, player.level, pos);
if (data[0] < 0) {
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
NetworkHooks.openGui((ServerPlayer) player, tile, pos);
} else {
var stack = tile.modules.getStackInSlot(data[0]);
NetworkHooks.openScreen((ServerPlayer) player, new MenuProvider() {
NetworkHooks.openGui((ServerPlayer) player, new MenuProvider() {
@Override
public Component getDisplayName() {
return stack.getHoverName();

View file

@ -92,7 +92,7 @@ public class PipeBlock extends BaseEntityBlock {
}
} else if (handIn == InteractionHand.MAIN_HAND && stack.isEmpty()) {
if (!worldIn.isClientSide)
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
NetworkHooks.openGui((ServerPlayer) player, tile, pos);
return InteractionResult.SUCCESS;
}
return InteractionResult.PASS;

View file

@ -2,11 +2,15 @@ package de.ellpeck.prettypipes.pipe;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.util.RandomSource;
import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer;
import java.util.Random;
@ -32,14 +36,18 @@ public class PipeRenderer implements BlockEntityRenderer<PipeBlockEntity> {
}
if (tile.cover != null) {
matrixStack.pushPose();
ForgeBlockModelRenderer.enableCaching();
var renderer = Minecraft.getInstance().getBlockRenderer();
var model = renderer.getBlockModel(tile.cover);
for (var layer : model.getRenderTypes(tile.cover, RandomSource.create(tile.cover.getSeed(tile.getBlockPos())), ModelData.EMPTY)) {
renderer.getModelRenderer().tesselateBlock(tile.getLevel(), model, tile.cover, tile.getBlockPos(), matrixStack, source.getBuffer(layer), true, RandomSource.create(), tile.cover.getSeed(tile.getBlockPos()), overlay, ModelData.EMPTY, layer);
for (var layer : RenderType.chunkBufferLayers()) {
if (!ItemBlockRenderTypes.canRenderInLayer(tile.cover, layer))
continue;
ForgeHooksClient.setRenderType(layer);
renderer.getModelRenderer().tesselateBlock(tile.getLevel(), renderer.getBlockModel(tile.cover), tile.cover, tile.getBlockPos(), matrixStack, source.getBuffer(layer), true, RandomSource.create(), tile.cover.getSeed(tile.getBlockPos()), overlay, EmptyModelData.INSTANCE);
}
ForgeHooksClient.setRenderType(null);
ForgeBlockModelRenderer.clearCache();
matrixStack.popPose();
}
}
}

View file

@ -34,7 +34,7 @@ public class StackSizeModuleGui extends AbstractPipeGui<StackSizeModuleContainer
}
});
textField.setValue(String.valueOf(StackSizeModuleItem.getMaxStackSizeForModule(this.menu.moduleStack)));
textField.setValue(String.valueOf(StackSizeModuleItem.getMaxStackSize(this.menu.moduleStack)));
textField.setMaxLength(4);
textField.setResponder(s -> {
if (s.isEmpty())

View file

@ -17,7 +17,7 @@ public class StackSizeModuleItem extends ModuleItem {
super("stack_size_module");
}
public static int getMaxStackSizeForModule(ItemStack module) {
public static int getMaxStackSize(ItemStack module) {
if (module.hasTag()) {
var amount = module.getTag().getInt("max_stack_size");
if (amount > 0)
@ -42,7 +42,7 @@ public class StackSizeModuleItem extends ModuleItem {
@Override
public int getMaxInsertionAmount(ItemStack module, PipeBlockEntity tile, ItemStack stack, IItemHandler destination) {
var max = StackSizeModuleItem.getMaxStackSizeForModule(module);
var max = StackSizeModuleItem.getMaxStackSize(module);
if (StackSizeModuleItem.getLimitToMaxStackSize(module))
max = Math.min(max, stack.getMaxStackSize());
var amount = 0;

View file

@ -40,7 +40,7 @@ public class PressurizerBlock extends BaseEntityBlock {
if (tile == null)
return InteractionResult.PASS;
if (!worldIn.isClientSide)
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
NetworkHooks.openGui((ServerPlayer) player, tile, pos);
return InteractionResult.SUCCESS;
}

View file

@ -46,7 +46,7 @@ public class ItemTerminalBlock extends BaseEntityBlock {
return InteractionResult.SUCCESS;
}
if (!worldIn.isClientSide) {
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
NetworkHooks.openGui((ServerPlayer) player, tile, pos);
tile.updateItems(player);
}
return InteractionResult.SUCCESS;

View file

@ -1,7 +1,6 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"render_type": "cutout",
"textures": {
"0": "prettypipes:block/pipe",
"particle": "prettypipes:block/pipe"

View file

@ -1,6 +1,5 @@
{
"credit": "Made with Blockbench",
"render_type": "cutout",
"textures": {
"0": "prettypipes:block/pipe",
"particle": "prettypipes:block/pipe"

View file

@ -1,7 +1,6 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"render_type": "cutout",
"textures": {
"1": "prettypipes:block/pipe_legs",
"particle": "prettypipes:block/pipe"