Skip to content

Commit

Permalink
Update to 1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Dec 9, 2022
1 parent a8f8307 commit 41cff86
Show file tree
Hide file tree
Showing 68 changed files with 378 additions and 445 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ dependencies {
//modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:6.0.254-alpha"
//modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:6.0.254-alpha"

modCompileOnly "maven.modrinth:iris:1.19.x-v1.2.5"
modCompileOnly "maven.modrinth:iris:1.19.3-v1.4.6"

// For running with Iris. Can be ignored most of the time.
// modRuntimeOnly "maven.modrinth:iris:1.19.x-v1.2.5"
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx3G

# Mod properties
mod_version=1.101.2
mod_version=1.102.0

# Minecraft properties
mc_version=1.19.1
fabric_api_version=0.58.5+1.19.1
fabric_loader_version=0.14.8
mc_version=1.19.3
fabric_api_version=0.68.1+1.19.3
fabric_loader_version=0.14.11

modmenu_version=4.0.5
modmenu_version=5.0.1
netty_http_version=4.1.77.Final
25 changes: 13 additions & 12 deletions src/main/java/dan200/computercraft/ComputerCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -103,20 +104,20 @@ public final class ComputerCraft
public static void onInitialize()
{
ComputerCraftProxyCommon.init();
Registry.register( Registry.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "colour" ), ColourableRecipe.SERIALIZER );
Registry.register( Registry.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "computer_upgrade" ), ComputerUpgradeRecipe.SERIALIZER );
Registry.register( Registry.RECIPE_SERIALIZER,
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "colour" ), ColourableRecipe.SERIALIZER );
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "computer_upgrade" ), ComputerUpgradeRecipe.SERIALIZER );
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER,
new ResourceLocation( ComputerCraft.MOD_ID, "pocket_computer_upgrade" ),
PocketComputerUpgradeRecipe.SERIALIZER );
Registry.register( Registry.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "disk" ), DiskRecipe.SERIALIZER );
Registry.register( Registry.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "printout" ), PrintoutRecipe.SERIALIZER );
Registry.register( Registry.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "turtle" ), TurtleRecipe.SERIALIZER );
Registry.register( Registry.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "turtle_upgrade" ), TurtleUpgradeRecipe.SERIALIZER );
Registry.register( Registry.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "impostor_shaped" ), ImpostorRecipe.SERIALIZER );
Registry.register( Registry.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "impostor_shapeless" ), ImpostorShapelessRecipe.SERIALIZER );
Registry.register( Registry.LOOT_CONDITION_TYPE, new ResourceLocation( ComputerCraft.MOD_ID, "block_named" ), BlockNamedEntityLootCondition.TYPE );
Registry.register( Registry.LOOT_CONDITION_TYPE, new ResourceLocation( ComputerCraft.MOD_ID, "player_creative" ), PlayerCreativeLootCondition.TYPE );
Registry.register( Registry.LOOT_CONDITION_TYPE, new ResourceLocation( ComputerCraft.MOD_ID, "has_id" ), HasComputerIdLootCondition.TYPE );
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "disk" ), DiskRecipe.SERIALIZER );
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "printout" ), PrintoutRecipe.SERIALIZER );
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "turtle" ), TurtleRecipe.SERIALIZER );
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "turtle_upgrade" ), TurtleUpgradeRecipe.SERIALIZER );
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "impostor_shaped" ), ImpostorRecipe.SERIALIZER );
Registry.register( BuiltInRegistries.RECIPE_SERIALIZER, new ResourceLocation( ComputerCraft.MOD_ID, "impostor_shapeless" ), ImpostorShapelessRecipe.SERIALIZER );
Registry.register( BuiltInRegistries.LOOT_CONDITION_TYPE, new ResourceLocation( ComputerCraft.MOD_ID, "block_named" ), BlockNamedEntityLootCondition.TYPE );
Registry.register( BuiltInRegistries.LOOT_CONDITION_TYPE, new ResourceLocation( ComputerCraft.MOD_ID, "player_creative" ), PlayerCreativeLootCondition.TYPE );
Registry.register( BuiltInRegistries.LOOT_CONDITION_TYPE, new ResourceLocation( ComputerCraft.MOD_ID, "has_id" ), HasComputerIdLootCondition.TYPE );
init();
GameInstanceUtils.init();
FabricLoader.getInstance().getModContainer( MOD_ID ).ifPresent( modContainer -> {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/dan200/computercraft/api/ComputerCraftTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package dan200.computercraft.api;

import dan200.computercraft.ComputerCraft;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
Expand All @@ -26,7 +26,7 @@ public static class Items

private static TagKey<Item> make( String name )
{
return TagKey.create( Registry.ITEM_REGISTRY, new ResourceLocation( ComputerCraft.MOD_ID, name ) );
return TagKey.create( Registries.ITEM, new ResourceLocation( ComputerCraft.MOD_ID, name ) );
}
}

Expand Down Expand Up @@ -59,7 +59,7 @@ public static class Blocks

private static TagKey<Block> make( String name )
{
return TagKey.create( Registry.BLOCK_REGISTRY, new ResourceLocation( ComputerCraft.MOD_ID, name ) );
return TagKey.create( Registries.BLOCK, new ResourceLocation( ComputerCraft.MOD_ID, name ) );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Transformation;
import com.mojang.math.Vector3f;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.world.item.ItemStack;
import org.joml.Vector3f;

import javax.annotation.Nonnull;
import java.util.Objects;
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/dan200/computercraft/api/turtle/FakePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public abstract class FakePlayer extends ServerPlayer
{
public FakePlayer( ServerLevel world, GameProfile gameProfile )
{
super( world.getServer(), world, gameProfile, null );
super( world.getServer(), world, gameProfile );
connection = new FakeNetHandler( this );
}

Expand Down Expand Up @@ -209,12 +209,6 @@ public void teleportTo( double x, double y, double z )
// {
// }


@Override
public void sendChatMessage( OutgoingPlayerChatMessage outgoingPlayerChatMessage, boolean bl, ChatType.Bound bound )
{
}

@Override
public void sendSystemMessage( Component component, boolean bl )
{
Expand Down Expand Up @@ -265,4 +259,9 @@ public void untrackChunk( ChunkPos chunkPos )
public void playNotifySound( SoundEvent soundEvent, SoundSource soundCategory, float volume, float pitch )
{
}

@Override
public void sendChatMessage( OutgoingChatMessage outgoingChatMessage, boolean bl, ChatType.Bound bound )
{
}
}
15 changes: 2 additions & 13 deletions src/main/java/dan200/computercraft/client/ClientRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
import dan200.computercraft.shared.util.Colour;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.resources.model.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager;

import java.util.HashSet;
import java.util.function.Consumer;

/**
Expand Down Expand Up @@ -65,13 +61,6 @@ public final class ClientRegistry

private ClientRegistry() {}

public static void onTextureStitchEvent( TextureAtlas atlasTexture, ClientSpriteRegistryCallback.Registry registry )
{
for( String extra : EXTRA_TEXTURES )
{
registry.register( new ResourceLocation( ComputerCraft.MOD_ID, extra ) );
}
}

@SuppressWarnings( "NewExpressionSideOnly" )
public static void onModelBakeEvent( ResourceManager manager, Consumer<ResourceLocation> out )
Expand Down Expand Up @@ -111,7 +100,7 @@ public static void onItemColours()
Registry.ModBlocks.TURTLE_ADVANCED );
}

private static BakedModel bake( ModelBakery loader, UnbakedModel model, ResourceLocation identifier )
/*private static BakedModel bake( ModelBakery loader, UnbakedModel model, ResourceLocation identifier )
{
model.getMaterials( loader::getModel, new HashSet<>() );
return model.bake( loader,
Expand All @@ -120,5 +109,5 @@ private static BakedModel bake( ModelBakery loader, UnbakedModel model, Resource
.apply( spriteIdentifier.texture() ),
BlockModelRotation.X0_Y0,
identifier );
}
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public ComputerScreenBase( T container, Inventory player, Component title, int s
protected void init()
{
super.init();
minecraft.keyboardHandler.setSendRepeatsToGui( true );

terminal = addRenderableWidget( createTerminal() );
ComputerSidebar.addButtons( this, computer, this::addRenderableWidget, leftPos, topPos + sidebarYOffset );
Expand All @@ -71,7 +70,6 @@ protected void init()
public void removed()
{
super.removed();
minecraft.keyboardHandler.setSendRepeatsToGui( false );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void renderBg( @Nonnull PoseStack stack, float partialTicks, int mouseX,
{
// Draw a border around the terminal
ComputerBorderRenderer.renderFromGui(
ComputerBorderRenderer.getTexture( family ), terminal.x, terminal.y, getBlitOffset(),
ComputerBorderRenderer.getTexture( family ), terminal.getX(), terminal.getY(), getBlitOffset(),
FULL_BRIGHT_LIGHTMAP, terminal.getWidth(), terminal.getHeight()
);
ComputerSidebar.renderBackground( stack, leftPos, topPos + sidebarYOffset );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ protected void init()
KeyMapping.releaseAll();

super.init();
minecraft.keyboardHandler.setSendRepeatsToGui( true );

terminal = addWidget( new WidgetTerminal( (ClientComputer) menu.getComputer(), 0, 0, ComputerCraft.pocketTermWidth, ComputerCraft.pocketTermHeight ) );
terminal.visible = false;
Expand All @@ -63,7 +62,6 @@ protected void init()
public final void removed()
{
super.removed();
minecraft.keyboardHandler.setSendRepeatsToGui( false );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public void init()
int x = (width - buttonWidth) / 2;
for( AbstractWidget button : buttons )
{
button.x = x;
button.y = y + textHeight;
button.setX( x );
button.setY( y + textHeight );
addRenderableWidget( button );

x += BUTTON_WIDTH + PADDING;
Expand Down Expand Up @@ -112,7 +112,7 @@ public void onClose()

public static AbstractWidget newButton( Component component, Button.OnPress clicked )
{
return new Button( 0, 0, BUTTON_WIDTH, BUTTON_HEIGHT, component, clicked );
return Button.builder( component, clicked ).pos( 0, 0 ).width( BUTTON_WIDTH ).build();
}

public void disable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public DynamicImageButton(
OnPress onPress, NonNullSupplier<List<Component>> tooltip
)
{
super( x, y, width, height, Component.empty(), onPress );
super( x, y, width, height, Component.empty(), onPress, DEFAULT_NARRATION );
this.screen = screen;
this.textureWidth = textureWidth;
this.textureHeight = textureHeight;
Expand All @@ -72,7 +72,7 @@ public void renderButton( @Nonnull PoseStack stack, int mouseX, int mouseY, floa
int yTex = yTexStart;
if( isHoveredOrFocused() ) yTex += yDiffTex;

blit( stack, x, y, xTexStart.getAsInt(), yTex, width, height, textureWidth, textureHeight );
blit( stack, getX(), getY(), xTexStart.getAsInt(), yTex, width, height, textureWidth, textureHeight );
RenderSystem.enableDepthTest();

if( isHovered ) renderToolTip( stack, mouseX, mouseY );
Expand All @@ -86,7 +86,6 @@ public Component getMessage()
return tooltip.isEmpty() ? Component.empty() : tooltip.get( 0 );
}

@Override
public void renderToolTip( @Nonnull PoseStack stack, int mouseX, int mouseY )
{
List<Component> tooltip = this.tooltip.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,14 @@ public void render( @Nonnull PoseStack transform, int mouseX, int mouseY, float
}
else
{
FixedWidthFontRenderer.drawEmptyTerminal( emitter, (float) x, (float) y, (float) width, (float) height );
FixedWidthFontRenderer.drawEmptyTerminal( emitter, (float) getX(), (float) getY(), (float) width, (float) height );
}

bufferSource.endBatch();
}

@Override
public void updateNarration( @Nonnull NarrationElementOutput output )
protected void updateWidgetNarration( NarrationElementOutput narrationElementOutput )
{
// I'm not sure what the right option is here.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.multiplayer.ClientLevel;
Expand All @@ -44,7 +43,6 @@
import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -97,8 +95,6 @@ public void onInitializeClient()
BlockEntityRendererRegistry.register( Registry.ModBlockEntities.TURTLE_NORMAL, TileEntityTurtleRenderer::new );
BlockEntityRendererRegistry.register( Registry.ModBlockEntities.TURTLE_ADVANCED, TileEntityTurtleRenderer::new );

ClientSpriteRegistryCallback.event( InventoryMenu.BLOCK_ATLAS )
.register( ClientRegistry::onTextureStitchEvent );
ModelLoadingRegistry.INSTANCE.registerModelProvider( ClientRegistry::onModelBakeEvent );
ModelLoadingRegistry.INSTANCE.registerResourceProvider( loader -> ( name, context ) -> TurtleModelLoader.INSTANCE.accepts( name ) ?
TurtleModelLoader.INSTANCE.loadModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import dan200.computercraft.shared.Registry;
import dan200.computercraft.shared.peripheral.modem.wired.BlockCable;
import dan200.computercraft.shared.peripheral.modem.wired.CableShapes;
Expand All @@ -24,6 +22,8 @@
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.joml.Matrix3f;
import org.joml.Matrix4f;

@Environment( EnvType.CLIENT )
public final class CableHighlightRenderer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import org.joml.Matrix3f;
import org.joml.Matrix4f;

import javax.annotation.Nonnull;

Expand All @@ -29,7 +29,7 @@ public class ComputerBorderRenderer

static
{
IDENTITY.setIdentity();
IDENTITY.identity();
}

/**
Expand Down
Loading

0 comments on commit 41cff86

Please sign in to comment.