mirror of
https://github.com/GeyserMC/Rainbow.git
synced 2025-12-19 14:59:16 +00:00
Rename this too
This commit is contained in:
@@ -5,7 +5,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||||||
// Implemented on BlockModelWrapper, since this class doesn't store its model after baking, we have to store it manually
|
// Implemented on BlockModelWrapper, since this class doesn't store its model after baking, we have to store it manually
|
||||||
public interface BlockModelWrapperLocationAccessor {
|
public interface BlockModelWrapperLocationAccessor {
|
||||||
|
|
||||||
ResourceLocation geyser_mappings_generator$getModelOrigin();
|
ResourceLocation rainbow$getModelOrigin();
|
||||||
|
|
||||||
void geyser_mappings_generator$setModelOrigin(ResourceLocation model);
|
void rainbow$setModelOrigin(ResourceLocation model);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ import java.util.Optional;
|
|||||||
// Implemented on ModelManager, since this class doesn't keep the resolved models after baking, we have to store it manually
|
// Implemented on ModelManager, since this class doesn't keep the resolved models after baking, we have to store it manually
|
||||||
public interface ResolvedModelAccessor {
|
public interface ResolvedModelAccessor {
|
||||||
|
|
||||||
Optional<ResolvedModel> geyser_mappings_generator$getResolvedModel(ResourceLocation location);
|
Optional<ResolvedModel> rainbow$getResolvedModel(ResourceLocation location);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import net.minecraft.client.renderer.item.ItemModel;
|
|||||||
// Implemented on BlockModelWrapper, since this class doesn't store the cases it has in a nice format after baking, we have to store it manually
|
// Implemented on BlockModelWrapper, since this class doesn't store the cases it has in a nice format after baking, we have to store it manually
|
||||||
public interface SelectItemModelCasesAccessor<T> {
|
public interface SelectItemModelCasesAccessor<T> {
|
||||||
|
|
||||||
Object2ObjectMap<T, ItemModel> geyser_mappings_generator$getCases();
|
Object2ObjectMap<T, ItemModel> rainbow$getCases();
|
||||||
|
|
||||||
void geyser_mappings_generator$setCases(Object2ObjectMap<T, ItemModel> cases);
|
void rainbow$setCases(Object2ObjectMap<T, ItemModel> cases);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ public class BedrockItemMapper {
|
|||||||
private static void mapItem(ItemModel model, MappingContext context) {
|
private static void mapItem(ItemModel model, MappingContext context) {
|
||||||
switch (model) {
|
switch (model) {
|
||||||
case BlockModelWrapper modelWrapper -> {
|
case BlockModelWrapper modelWrapper -> {
|
||||||
ResourceLocation itemModelLocation = ((BlockModelWrapperLocationAccessor) modelWrapper).geyser_mappings_generator$getModelOrigin();
|
ResourceLocation itemModelLocation = ((BlockModelWrapperLocationAccessor) modelWrapper).rainbow$getModelOrigin();
|
||||||
|
|
||||||
((ResolvedModelAccessor) Minecraft.getInstance().getModelManager()).geyser_mappings_generator$getResolvedModel(itemModelLocation)
|
((ResolvedModelAccessor) Minecraft.getInstance().getModelManager()).rainbow$getResolvedModel(itemModelLocation)
|
||||||
.ifPresentOrElse(itemModel -> {
|
.ifPresentOrElse(itemModel -> {
|
||||||
ResolvedModel parentModel = itemModel.parent();
|
ResolvedModel parentModel = itemModel.parent();
|
||||||
boolean handheld = false;
|
boolean handheld = false;
|
||||||
@@ -153,7 +153,7 @@ public class BedrockItemMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
Object2ObjectMap<T, ItemModel> cases = ((SelectItemModelCasesAccessor<T>) model).geyser_mappings_generator$getCases();
|
Object2ObjectMap<T, ItemModel> cases = ((SelectItemModelCasesAccessor<T>) model).rainbow$getCases();
|
||||||
|
|
||||||
cases.forEach((key, value) -> mapItem(value, context.with(new GeyserMatchPredicate(dataConstructor.apply(key)), "select case " + key + " ")));
|
cases.forEach((key, value) -> mapItem(value, context.with(new GeyserMatchPredicate(dataConstructor.apply(key)), "select case " + key + " ")));
|
||||||
mapItem(cases.defaultReturnValue(), context.child("default case "));
|
mapItem(cases.defaultReturnValue(), context.child("default case "));
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ public abstract class BlockModelWrapperMixin implements ItemModel, BlockModelWra
|
|||||||
private ResourceLocation modelOrigin;
|
private ResourceLocation modelOrigin;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation geyser_mappings_generator$getModelOrigin() {
|
public ResourceLocation rainbow$getModelOrigin() {
|
||||||
return modelOrigin;
|
return modelOrigin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void geyser_mappings_generator$setModelOrigin(ResourceLocation model) {
|
public void rainbow$setModelOrigin(ResourceLocation model) {
|
||||||
modelOrigin = model;
|
modelOrigin = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public abstract class BlockModelWrapperMixin implements ItemModel, BlockModelWra
|
|||||||
|
|
||||||
@Inject(method = "bake", at = @At("TAIL"))
|
@Inject(method = "bake", at = @At("TAIL"))
|
||||||
public void setModelOrigin(BakingContext context, CallbackInfoReturnable<ItemModel> callbackInfoReturnable) {
|
public void setModelOrigin(BakingContext context, CallbackInfoReturnable<ItemModel> callbackInfoReturnable) {
|
||||||
((BlockModelWrapperLocationAccessor) callbackInfoReturnable.getReturnValue()).geyser_mappings_generator$setModelOrigin(model);
|
((BlockModelWrapperLocationAccessor) callbackInfoReturnable.getReturnValue()).rainbow$setModelOrigin(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public abstract class ModelManagerMixin implements PreparableReloadListener, Aut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ResolvedModel> geyser_mappings_generator$getResolvedModel(ResourceLocation location) {
|
public Optional<ResolvedModel> rainbow$getResolvedModel(ResourceLocation location) {
|
||||||
return unbakedResolvedModels == null ? Optional.empty() : Optional.ofNullable(unbakedResolvedModels.get(location));
|
return unbakedResolvedModels == null ? Optional.empty() : Optional.ofNullable(unbakedResolvedModels.get(location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ public abstract class SelectItemModelMixin<T> implements ItemModel, SelectItemMo
|
|||||||
private Object2ObjectMap<T, ItemModel> cases;
|
private Object2ObjectMap<T, ItemModel> cases;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object2ObjectMap<T, ItemModel> geyser_mappings_generator$getCases() {
|
public Object2ObjectMap<T, ItemModel> rainbow$getCases() {
|
||||||
return cases;
|
return cases;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void geyser_mappings_generator$setCases(Object2ObjectMap<T, ItemModel> cases) {
|
public void rainbow$setCases(Object2ObjectMap<T, ItemModel> cases) {
|
||||||
this.cases = cases;
|
this.cases = cases;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public abstract class SelectItemModelMixin<T> implements ItemModel, SelectItemMo
|
|||||||
public void setCases(BakingContext bakingContext, ItemModel model, CallbackInfoReturnable<ItemModel> callbackInfoReturnable,
|
public void setCases(BakingContext bakingContext, ItemModel model, CallbackInfoReturnable<ItemModel> callbackInfoReturnable,
|
||||||
@Local Object2ObjectMap<T, ItemModel> cases) {
|
@Local Object2ObjectMap<T, ItemModel> cases) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
((SelectItemModelCasesAccessor<T>) callbackInfoReturnable.getReturnValue()).geyser_mappings_generator$setCases(cases);
|
((SelectItemModelCasesAccessor<T>) callbackInfoReturnable.getReturnValue()).rainbow$setCases(cases);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user