Update testmod to 1.19.4

This commit is contained in:
embeddedt 2023-08-10 10:54:27 -04:00
parent a506f8785e
commit 24e014f326
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
3 changed files with 7 additions and 10 deletions

View File

@ -1,11 +1,10 @@
package org.embeddedt.modernfix.testmod; package org.embeddedt.modernfix.testmod;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
public class TestBlockItem extends BlockItem { public class TestBlockItem extends BlockItem {
private static final Item.Properties PROPERTIES = new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS); private static final Item.Properties PROPERTIES = new Item.Properties();
public TestBlockItem(TestBlock block) { public TestBlockItem(TestBlock block) {
super(block, PROPERTIES); super(block, PROPERTIES);

View File

@ -3,6 +3,7 @@ package org.embeddedt.modernfix.testmod;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -32,9 +33,9 @@ public class TestMod implements ModInitializer {
for(int g = 0; g < NUM_COLORS; g++) { for(int g = 0; g < NUM_COLORS; g++) {
for(int b = 0; b < NUM_COLORS; b++) { for(int b = 0; b < NUM_COLORS; b++) {
ResourceLocation name = new ResourceLocation(ID, "wool_" + r + "_" + g + "_" + b); ResourceLocation name = new ResourceLocation(ID, "wool_" + r + "_" + g + "_" + b);
TestBlock block = Registry.register(Registry.BLOCK, name, new TestBlock()); TestBlock block = Registry.register(BuiltInRegistries.BLOCK, name, new TestBlock());
WOOL_STATES.add(block.defaultBlockState()); WOOL_STATES.add(block.defaultBlockState());
Registry.register(Registry.ITEM, name, new TestBlockItem(block)); Registry.register(BuiltInRegistries.ITEM, name, new TestBlockItem(block));
numRegistered++; numRegistered++;
if((numRegistered % progressReport) == 0) { if((numRegistered % progressReport) == 0) {
LOGGER.info(String.format("Registering... %.02f%%", ((float)numRegistered)/totalToRegister * 100)); LOGGER.info(String.format("Registering... %.02f%%", ((float)numRegistered)/totalToRegister * 100));

View File

@ -1,7 +1,5 @@
package org.embeddedt.modernfix.testmod.client; package org.embeddedt.modernfix.testmod.client;
import com.google.common.collect.ImmutableList;
import com.mojang.datafixers.util.Pair;
import net.fabricmc.fabric.api.renderer.v1.Renderer; import net.fabricmc.fabric.api.renderer.v1.Renderer;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess; import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh; import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
@ -30,7 +28,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -109,8 +106,8 @@ public class TestModBlockModel implements UnbakedModel, BakedModel, FabricBakedM
} }
@Override @Override
public Collection<Material> getMaterials(Function<ResourceLocation, UnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) { public void resolveParents(Function<ResourceLocation, UnbakedModel> function) {
return ImmutableList.of(BASE_WOOL);
} }
private static int scaleColor(int c) { private static int scaleColor(int c) {
@ -119,7 +116,7 @@ public class TestModBlockModel implements UnbakedModel, BakedModel, FabricBakedM
@Nullable @Nullable
@Override @Override
public BakedModel bake(ModelBakery modelBakery, Function<Material, TextureAtlasSprite> spriteGetter, ModelState transform, ResourceLocation location) { public BakedModel bake(ModelBaker baker, Function<Material, TextureAtlasSprite> spriteGetter, ModelState state, ResourceLocation location) {
// Build the mesh using the Renderer API // Build the mesh using the Renderer API
Renderer renderer = RendererAccess.INSTANCE.getRenderer(); Renderer renderer = RendererAccess.INSTANCE.getRenderer();
MeshBuilder builder = renderer.meshBuilder(); MeshBuilder builder = renderer.meshBuilder();