Fix rubber door model

This commit is contained in:
modmuss50 2022-05-21 20:15:08 +01:00
parent 5a0d017cd0
commit 9293931bd0
12 changed files with 156 additions and 79 deletions

View file

@ -26,6 +26,7 @@ package techreborn.datagen
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import techreborn.datagen.models.ModelProvider
import techreborn.datagen.recipes.crafting.CraftingRecipesProvider
import techreborn.datagen.recipes.machine.assembling_machine.AssemblingMachineRecipesProvider
import techreborn.datagen.recipes.machine.blast_furnace.BlastFurnaceRecipesProvider
@ -59,5 +60,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
fabricDataGenerator.addProvider(BlastFurnaceRecipesProvider.&new)
fabricDataGenerator.addProvider(IndustrialGrinderRecipesProvider.&new)
fabricDataGenerator.addProvider(IndustrialSawmillRecipesProvider.&new)
fabricDataGenerator.addProvider(ModelProvider.&new)
}
}

View file

@ -0,0 +1,50 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.datagen.mixin;
import net.minecraft.block.Block;
import net.minecraft.data.client.TextureMap;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import techreborn.datagen.models.TexturePaths;
import java.util.Map;
@Mixin(TextureMap.class)
public class MixinTextureMap {
@Inject(method = "getId(Lnet/minecraft/item/Item;)Lnet/minecraft/util/Identifier;", at = @At("HEAD"), cancellable = true)
private static void getId(Item item, CallbackInfoReturnable<Identifier> cir) {
for (Map.Entry<Block, String> entry : TexturePaths.blockItemTexturePaths.entrySet()) {
if (entry.getKey().asItem() == item) {
cir.setReturnValue(new Identifier("techreborn", "item/" + entry.getValue()));
}
}
}
}

View file

@ -0,0 +1,46 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.datagen.models
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider
import net.minecraft.data.client.BlockStateModelGenerator
import net.minecraft.data.client.ItemModelGenerator
import techreborn.init.TRContent
class ModelProvider extends FabricModelProvider {
ModelProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator)
}
@Override
void generateBlockStateModels(BlockStateModelGenerator generator) {
generator.registerDoor(TRContent.RUBBER_DOOR)
}
@Override
void generateItemModels(ItemModelGenerator generator) {
}
}

View file

@ -0,0 +1,34 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.datagen.models
import net.minecraft.block.Block
import techreborn.init.TRContent
class TexturePaths {
public static Map<Block, String> blockItemTexturePaths = [
(TRContent.RUBBER_DOOR): "misc/rubber_door"
]
}

View file

@ -1,12 +1,15 @@
{
"schemaVersion": 1,
"id": "techreborn-datagen",
"name": "TechReborn Datagen",
"version": "1.0.0",
"environment": "*",
"entrypoints": {
"fabric-datagen" : [
"techreborn.datagen.TechRebornDataGen"
"schemaVersion": 1,
"id": "techreborn-datagen",
"name": "TechReborn Datagen",
"version": "1.0.0",
"environment": "*",
"entrypoints": {
"fabric-datagen": [
"techreborn.datagen.TechRebornDataGen"
]
},
"mixins": [
"techreborn.datagen.mixins.json"
]
}
}

View file

@ -0,0 +1,11 @@
{
"required": true,
"package": "techreborn.datagen.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"MixinTextureMap"
],
"injectors": {
"defaultRequire": 1
}
}

View file

@ -1,36 +0,0 @@
{
"variants": {
"facing=east,half=lower,hinge=left,open=false": { "model": "techreborn:block/rubber/rubber_door_bottom" },
"facing=south,half=lower,hinge=left,open=false": { "model": "techreborn:block/rubber/rubber_door_bottom", "y": 90 },
"facing=west,half=lower,hinge=left,open=false": { "model": "techreborn:block/rubber/rubber_door_bottom", "y": 180 },
"facing=north,half=lower,hinge=left,open=false": { "model": "techreborn:block/rubber/rubber_door_bottom", "y": 270 },
"facing=east,half=lower,hinge=right,open=false": { "model": "techreborn:block/rubber/rubber_door_bottom_hinge" },
"facing=south,half=lower,hinge=right,open=false": { "model": "techreborn:block/rubber/rubber_door_bottom_hinge", "y": 90 },
"facing=west,half=lower,hinge=right,open=false": { "model": "techreborn:block/rubber/rubber_door_bottom_hinge", "y": 180 },
"facing=north,half=lower,hinge=right,open=false": { "model": "techreborn:block/rubber/rubber_door_bottom_hinge", "y": 270 },
"facing=east,half=lower,hinge=left,open=true": { "model": "techreborn:block/rubber/rubber_door_bottom_hinge", "y": 90 },
"facing=south,half=lower,hinge=left,open=true": { "model": "techreborn:block/rubber/rubber_door_bottom_hinge", "y": 180 },
"facing=west,half=lower,hinge=left,open=true": { "model": "techreborn:block/rubber/rubber_door_bottom_hinge", "y": 270 },
"facing=north,half=lower,hinge=left,open=true": { "model": "techreborn:block/rubber/rubber_door_bottom_hinge" },
"facing=east,half=lower,hinge=right,open=true": { "model": "techreborn:block/rubber/rubber_door_bottom", "y": 270 },
"facing=south,half=lower,hinge=right,open=true": { "model": "techreborn:block/rubber/rubber_door_bottom" },
"facing=west,half=lower,hinge=right,open=true": { "model": "techreborn:block/rubber/rubber_door_bottom", "y": 90 },
"facing=north,half=lower,hinge=right,open=true": { "model": "techreborn:block/rubber/rubber_door_bottom", "y": 180 },
"facing=east,half=upper,hinge=left,open=false": { "model": "techreborn:block/rubber/rubber_door_top" },
"facing=south,half=upper,hinge=left,open=false": { "model": "techreborn:block/rubber/rubber_door_top", "y": 90 },
"facing=west,half=upper,hinge=left,open=false": { "model": "techreborn:block/rubber/rubber_door_top", "y": 180 },
"facing=north,half=upper,hinge=left,open=false": { "model": "techreborn:block/rubber/rubber_door_top", "y": 270 },
"facing=east,half=upper,hinge=right,open=false": { "model": "techreborn:block/rubber/rubber_door_top_hinge" },
"facing=south,half=upper,hinge=right,open=false": { "model": "techreborn:block/rubber/rubber_door_top_hinge", "y": 90 },
"facing=west,half=upper,hinge=right,open=false": { "model": "techreborn:block/rubber/rubber_door_top_hinge", "y": 180 },
"facing=north,half=upper,hinge=right,open=false": { "model": "techreborn:block/rubber/rubber_door_top_hinge", "y": 270 },
"facing=east,half=upper,hinge=left,open=true": { "model": "techreborn:block/rubber/rubber_door_top_hinge", "y": 90 },
"facing=south,half=upper,hinge=left,open=true": { "model": "techreborn:block/rubber/rubber_door_top_hinge", "y": 180 },
"facing=west,half=upper,hinge=left,open=true": { "model": "techreborn:block/rubber/rubber_door_top_hinge", "y": 270 },
"facing=north,half=upper,hinge=left,open=true": { "model": "techreborn:block/rubber/rubber_door_top_hinge" },
"facing=east,half=upper,hinge=right,open=true": { "model": "techreborn:block/rubber/rubber_door_top", "y": 270 },
"facing=south,half=upper,hinge=right,open=true": { "model": "techreborn:block/rubber/rubber_door_top" },
"facing=west,half=upper,hinge=right,open=true": { "model": "techreborn:block/rubber/rubber_door_top", "y": 90 },
"facing=north,half=upper,hinge=right,open=true": { "model": "techreborn:block/rubber/rubber_door_top", "y": 180 }
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "minecraft:block/door_bottom",
"textures": {
"bottom": "techreborn:block/rubber_door_bottom",
"top": "techreborn:block/rubber_door_top"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "minecraft:block/door_bottom_rh",
"textures": {
"bottom": "techreborn:block/rubber_door_bottom",
"top": "techreborn:block/rubber_door_top"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "minecraft:block/door_top",
"textures": {
"bottom": "techreborn:block/rubber_door_bottom",
"top": "techreborn:block/rubber_door_top"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "minecraft:block/door_top_rh",
"textures": {
"bottom": "techreborn:block/rubber_door_bottom",
"top": "techreborn:block/rubber_door_top"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "techreborn:item/misc/rubber_door"
}
}