Skip to content

Commit

Permalink
Terrestria 1.1.1: Fix sign rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbot16 committed Dec 8, 2019
1 parent ea088c6 commit db7f6b0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
org.gradle.jvmargs=-Xmx1G

mod_version=1.1.0
mod_version=1.1.1
maven_group=com.terraformersmc
archive_name=terrestria

minecraft_version=1.15-pre6
yarn_mappings=1.15-pre6+build.1
loader_version=0.7.2+build.174
fabric_version=0.4.20+build.273-1.15
terraform_version=1.2.4+build.12
terraform_version=1.3.0+build.13
32 changes: 27 additions & 5 deletions src/main/java/com/terraformersmc/terrestria/TerrestriaClient.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.terraformersmc.terrestria;

import com.terraformersmc.terraform.block.TerraformSaplingBlock;
import com.terraformersmc.terraform.block.TerraformSignBlock;
import com.terraformersmc.terraform.entity.TerraformBoatEntity;
import com.terraformersmc.terraform.registry.SpriteIdentifierRegistry;
import com.terraformersmc.terrestria.init.TerrestriaBlocks;
import com.terraformersmc.terrestria.init.TerrestriaEntities;
import com.terraformersmc.terrestria.init.TerrestriaItems;
Expand All @@ -10,19 +11,17 @@
import net.fabricmc.fabric.api.client.render.ColorProviderRegistry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.client.color.block.BlockColorProvider;
import net.minecraft.client.color.item.ItemColorProvider;
import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.client.color.world.FoliageColors;
import net.minecraft.client.color.world.GrassColors;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderLayers;
import net.minecraft.client.render.TexturedRenderLayers;
import net.minecraft.client.render.entity.BoatEntityRenderer;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;

// This class is an entrypoint
@SuppressWarnings("unused")
Expand Down Expand Up @@ -76,6 +75,17 @@ public void onInitializeClient() {

addColoredGrass(TerrestriaBlocks.BASALT_GRASS_BLOCK);

addSigns(
TerrestriaBlocks.REDWOOD.sign,
TerrestriaBlocks.HEMLOCK.sign,
TerrestriaBlocks.RUBBER.sign,
TerrestriaBlocks.CYPRESS.sign,
TerrestriaBlocks.WILLOW.sign,
TerrestriaBlocks.JAPANESE_MAPLE.sign,
TerrestriaBlocks.RAINBOW_EUCALYPTUS.sign,
TerrestriaBlocks.SAKURA.sign
);

ColorProviderRegistry.ITEM.register(
FOLIAGE_ITEM_COLORS,
TerrestriaItems.RUBBER.leaves,
Expand Down Expand Up @@ -104,6 +114,18 @@ public void onInitializeClient() {
addBoatRenderer(TerrestriaEntities.SAKURA_BOAT);
}

private void addSigns(TerraformSignBlock... signs) {
for(TerraformSignBlock sign: signs) {
addSign(sign);
}
}

private void addSign(TerraformSignBlock sign) {
Identifier texture = sign.getTexture();

SpriteIdentifierRegistry.INSTANCE.addIdentifier(new SpriteIdentifier(TexturedRenderLayers.SIGNS_ATLAS_TEXTURE, texture));
}

private void addColoredGrass(Block grass) {
BlockRenderLayerMap.INSTANCE.putBlock(grass, GRASS_BLOCK_LAYER);
ColorProviderRegistry.BLOCK.register(GRASS_BLOCK_COLORS, grass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static WoodBlocks registerManufactured(String name, WoodColors colors, Fl
blocks.pressurePlate = TerrestriaRegistry.register(name + "_pressure_plate", new TerraformPressurePlateBlock(FabricBlockSettings.copy(Blocks.OAK_PRESSURE_PLATE).materialColor(colors.planks).build()));
blocks.trapdoor = TerrestriaRegistry.register(name + "_trapdoor", new TerraformTrapdoorBlock(FabricBlockSettings.copy(Blocks.OAK_TRAPDOOR).materialColor(colors.planks).build()));

Identifier signTexture = new Identifier(Terrestria.MOD_ID, "entity/signs/" + name + ".png");
Identifier signTexture = new Identifier(Terrestria.MOD_ID, "entity/signs/" + name);

blocks.sign = TerrestriaRegistry.register(name + "_sign", new TerraformSignBlock(signTexture, FabricBlockSettings.copy(Blocks.OAK_SIGN).materialColor(colors.planks).build()));
blocks.wallSign = TerrestriaRegistry.register(name + "_wall_sign", new TerraformWallSignBlock(signTexture, FabricBlockSettings.copy(Blocks.OAK_SIGN).materialColor(colors.planks).build()));
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
]
},
"depends": {
"fabricloader": ">=0.4.0",
"fabric": "*",
"terraform": "*"
"fabricloader": ">=0.7.2",
"fabric": ">=0.4.1",
"terraform": ">=1.3.0"
},
"mixins": [
"mixins.terrestria.json"
Expand Down

0 comments on commit db7f6b0

Please sign in to comment.