mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
Forge 1.19.4
Properly move `ServerStatusPing` to codec Reimplement custom display contexts Co-authored-by: Matyrobbrt <[email protected]> Co-authored-by: coehlrich <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
1f44339d6e
commit
44c689f171
347 files changed
+2545
-2436
No files matched your search
@@ -39,10 +39,10 @@ public class CustomArmorModelTest
|
||||
static final String MOD_ID = "custom_armor_model_test";
|
||||
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID);
|
||||
// demonstrates custom non-humanoid model
|
||||
private static final RegistryObject<Item> RED_LEGGINGS = ITEMS.register("red_leggings", () -> new TintedArmorItem(ArmorMaterials.DIAMOND, EquipmentSlot.LEGS, new Properties().stacksTo(1)));
|
||||
private static final RegistryObject<Item> RED_LEGGINGS = ITEMS.register("red_leggings", () -> new TintedArmorItem(ArmorMaterials.DIAMOND, ArmorItem.Type.LEGGINGS, new Properties().stacksTo(1)));
|
||||
// demonstrates the properties are copied from the vanilla model
|
||||
private static final RegistryObject<Item> ENDERMAN_CHESTPLATE = ITEMS.register("enderman_chestplate", () -> new EndermanArmorItem(ArmorMaterials.GOLD, EquipmentSlot.CHEST, new Properties().stacksTo(1)));
|
||||
private static final RegistryObject<Item> ENDERMAN_BOOTS = ITEMS.register("enderman_boots", () -> new EndermanArmorItem(ArmorMaterials.GOLD, EquipmentSlot.FEET, new Properties().stacksTo(1)));
|
||||
private static final RegistryObject<Item> ENDERMAN_CHESTPLATE = ITEMS.register("enderman_chestplate", () -> new EndermanArmorItem(ArmorMaterials.GOLD, ArmorItem.Type.CHESTPLATE, new Properties().stacksTo(1)));
|
||||
private static final RegistryObject<Item> ENDERMAN_BOOTS = ITEMS.register("enderman_boots", () -> new EndermanArmorItem(ArmorMaterials.GOLD, ArmorItem.Type.BOOTS, new Properties().stacksTo(1)));
|
||||
|
||||
public CustomArmorModelTest()
|
||||
{
|
||||
@@ -63,7 +63,7 @@ public class CustomArmorModelTest
|
||||
|
||||
private static class TintedArmorItem extends ArmorItem
|
||||
{
|
||||
public TintedArmorItem(ArmorMaterial material, EquipmentSlot slot, Properties props)
|
||||
public TintedArmorItem(ArmorMaterial material, ArmorItem.Type slot, Properties props)
|
||||
{
|
||||
super(material, slot, props);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class CustomArmorModelTest
|
||||
|
||||
private static class EndermanArmorItem extends ArmorItem
|
||||
{
|
||||
public EndermanArmorItem(ArmorMaterial material, EquipmentSlot slot, Properties props)
|
||||
public EndermanArmorItem(ArmorMaterial material, ArmorItem.Type slot, Properties props)
|
||||
{
|
||||
super(material, slot, props);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package net.minecraftforge.debug.client;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
@@ -49,7 +50,7 @@ public class CustomColorResolverTest
|
||||
private static class ClientHandler
|
||||
{
|
||||
|
||||
private static final ColorResolver COLOR_RESOLVER = (biome, x, z) -> biome.getPrecipitation() == Biome.Precipitation.NONE ? 0xFF0000 : 0x0000FF;
|
||||
private static final ColorResolver COLOR_RESOLVER = (biome, x, z) -> biome.getPrecipitationAt(BlockPos.containing(x, 0, z)) == Biome.Precipitation.NONE ? 0xFF0000 : 0x0000FF;
|
||||
|
||||
@SubscribeEvent
|
||||
static void registerColorResolver(RegisterColorHandlersEvent.ColorResolvers event)
|
||||
|
||||
@@ -94,7 +94,7 @@ public class CustomTooltipTest
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderImage(Font font, int x, int y, PoseStack poseStack, ItemRenderer itemRenderer_, int zIndex)
|
||||
public void renderImage(Font font, int x, int y, PoseStack poseStack, ItemRenderer itemRenderer_)
|
||||
{
|
||||
GuiComponent.fill(poseStack, x, y, x + 10, y+ 10, tooltip.color);
|
||||
}
|
||||
|
||||
+12
-11
@@ -8,7 +8,6 @@ package net.minecraftforge.debug.client.model;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
@@ -48,10 +47,11 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Test mod for the custom transform types feature.
|
||||
* This test mod adds an item that should be held in the main hand, while another item is in the offhand.
|
||||
* When right-clicked on a block, the item will "hang" the stack from the offhand slot on the wall.
|
||||
@@ -60,25 +60,26 @@ import org.jetbrains.annotations.Nullable;
|
||||
* when compared to similar items such as a fishing rod.
|
||||
* Editing that model json will reflect ingame after a resource reload (F3+T).
|
||||
*/
|
||||
@Mod(CustomTransformTypeTest.MODID)
|
||||
public class CustomTransformTypeTest
|
||||
@Mod(CustomItemDisplayContextTest.MODID)
|
||||
public class CustomItemDisplayContextTest
|
||||
{
|
||||
public static final String MODID = "custom_transformtype_test";
|
||||
|
||||
@Mod.EventBusSubscriber(value= Dist.CLIENT, modid = MODID, bus= Mod.EventBusSubscriber.Bus.MOD)
|
||||
@Mod.EventBusSubscriber(value= Dist.CLIENT, modid = MODID, bus= Mod.EventBusSubscriber.Bus.MOD)
|
||||
private static class RendererEvents
|
||||
{
|
||||
public static final ItemTransforms.TransformType HANGING = ItemTransforms.TransformType.create(
|
||||
"custom_transformtype_test_hanging",
|
||||
new ResourceLocation("custom_transformtype_test", "hanging")
|
||||
);
|
||||
|
||||
public static final ItemDisplayContext HANGING = ItemDisplayContext.create("custom_transformtype_test_hanging", new ResourceLocation("custom_transformtype_test", "hanging"), null);
|
||||
@SubscribeEvent
|
||||
public static void registerRenderers(EntityRenderersEvent.RegisterRenderers event)
|
||||
{
|
||||
event.registerBlockEntityRenderer(ITEM_HANGER_BE.get(), ItemHangerBlockEntityRenderer::new);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerContext(final RegisterEvent event) {
|
||||
event.register(ForgeRegistries.Keys.DISPLAY_CONTEXTS, helper -> helper.register("hanging", HANGING));
|
||||
}
|
||||
|
||||
private static class ItemHangerBlockEntityRenderer
|
||||
implements BlockEntityRenderer<ItemHangerBlockEntity>
|
||||
{
|
||||
@@ -121,7 +122,7 @@ public class CustomTransformTypeTest
|
||||
public static final RegistryObject<Item>
|
||||
ITEM_HANGER_ITEM = ITEMS.register("item_hanger", () -> new ItemHangerItem(ITEM_HANGER_BLOCK.get(), new Item.Properties()));
|
||||
|
||||
public CustomTransformTypeTest()
|
||||
public CustomItemDisplayContextTest()
|
||||
{
|
||||
var modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
modBus.addListener(this::gatherData);
|
||||
@@ -209,8 +209,8 @@ public class NewModelLoaderTest
|
||||
withExistingParent(NewModelLoaderTest.separate_perspective.getId().getPath(), "forge:item/default")
|
||||
.customLoader(SeparateTransformsModelBuilder::begin)
|
||||
.base(nested().parent(getExistingFile(mcLoc("minecraft:item/coal"))))
|
||||
.perspective(ItemTransforms.TransformType.GUI, nested().parent(getExistingFile(mcLoc("minecraft:item/snowball"))))
|
||||
.perspective(ItemTransforms.TransformType.FIRST_PERSON_LEFT_HAND, nested().parent(getExistingFile(mcLoc("minecraft:item/bone"))))
|
||||
.perspective(ItemDisplayContext.GUI, nested().parent(getExistingFile(mcLoc("minecraft:item/snowball"))))
|
||||
.perspective(ItemDisplayContext.FIRST_PERSON_LEFT_HAND, nested().parent(getExistingFile(mcLoc("minecraft:item/bone"))))
|
||||
.end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ public class CustomItemDecorationsTest
|
||||
@Override
|
||||
public boolean render(Font font, ItemStack stack, int xOffset, int yOffset, float blitOffset)
|
||||
{
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.disableBlend();
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
BufferBuilder bufferbuilder = tesselator.getBuilder();
|
||||
@@ -61,7 +60,6 @@ public class CustomItemDecorationsTest
|
||||
fillRect(bufferbuilder, xOffset + 2, yOffset, blitOffset + 189, 13, 2, 0, 0, 0);
|
||||
fillRect(bufferbuilder, xOffset + 2, yOffset, blitOffset + 190, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableTexture();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ public class RenderableTest
|
||||
private static void render(Stage stage, PoseStack poseStack, int renderTick, float partialTick, double camX, double camY, double camZ, int xOffset)
|
||||
{
|
||||
double x = camX, y = camY, z = camZ;
|
||||
if (!new BlockPos(0, y, 0).closerThan(new BlockPos(x, y, z), 100))
|
||||
if (!BlockPos.containing(0, y, 0).closerThan(BlockPos.containing(x, y, z), 100))
|
||||
return;
|
||||
|
||||
var profiler = Minecraft.getInstance().getProfiler();
|
||||
|
||||
Reference in new issue
Block a user