-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block rendering works... but not really
- Loading branch information
Showing
9 changed files
with
73 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 12 additions & 12 deletions
24
src/main/java/com/github/certifiedtater/lifesteal/block/SimplePolymerTexturedBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
package com.github.certifiedtater.lifesteal.block; | ||
|
||
import com.github.certifiedtater.lifesteal.Lifesteal; | ||
import eu.pb4.polymer.blocks.api.BlockModelType; | ||
import eu.pb4.polymer.blocks.api.PolymerBlockModel; | ||
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils; | ||
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; | ||
import eu.pb4.polymer.core.api.block.SimplePolymerBlock; | ||
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.util.Identifier; | ||
import xyz.nucleoid.packettweaker.PacketContext; | ||
|
||
public class SimplePolymerTexturedBlock extends SimplePolymerBlock implements PolymerTexturedBlock { | ||
private final Identifier id; | ||
public SimplePolymerTexturedBlock(Settings settings, Block polymerBlock, Identifier identifier) { | ||
super(settings, polymerBlock); | ||
this.id = identifier; | ||
public class SimplePolymerTexturedBlock extends Block implements PolymerTexturedBlock { | ||
private final BlockState polymerBlockState; | ||
|
||
public SimplePolymerTexturedBlock(Settings settings, String modelId) { | ||
super(settings); | ||
|
||
this.polymerBlockState = PolymerBlockResourceUtils.requestBlock( | ||
BlockModelType.FULL_BLOCK, | ||
PolymerBlockModel.of(Identifier.of(Lifesteal.MOD_ID, modelId))); | ||
|
||
} | ||
|
||
@Override | ||
public BlockState getPolymerBlockState(BlockState state, PacketContext context) { | ||
if (PolymerResourcePackUtils.hasMainPack(context)) { | ||
return PolymerBlockResourceUtils.requestBlock(BlockModelType.FULL_BLOCK, PolymerBlockModel.of(Identifier.of(id.getNamespace(), "block/" + id.getPath()))); | ||
} else { | ||
return super.getPolymerBlockState(state, context); | ||
} | ||
return this.polymerBlockState; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/github/certifiedtater/lifesteal/block/SimplePolymerTexturedBlockItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.github.certifiedtater.lifesteal.block; | ||
|
||
import eu.pb4.polymer.resourcepack.extras.api.ResourcePackExtras; | ||
import com.github.certifiedtater.lifesteal.Lifesteal; | ||
import eu.pb4.polymer.core.api.item.PolymerItem; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.item.BlockItem; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.Nullable; | ||
import xyz.nucleoid.packettweaker.PacketContext; | ||
|
||
public class SimplePolymerTexturedBlockItem extends BlockItem implements PolymerItem { | ||
private final Identifier polymerModel; | ||
private final Item polymerItem; | ||
public SimplePolymerTexturedBlockItem(Settings settings, Block block, String modelId, Item polymerItem) { | ||
super(block, settings); | ||
this.polymerModel = ResourcePackExtras.bridgeModel(Identifier.of(Lifesteal.MOD_ID, modelId)); | ||
this.polymerItem = polymerItem; | ||
} | ||
|
||
@Override | ||
public Item getPolymerItem(ItemStack itemStack, PacketContext player) { | ||
return this.polymerItem; | ||
} | ||
|
||
@Override | ||
public @Nullable Identifier getPolymerItemModel(ItemStack stack, PacketContext context) { | ||
return this.polymerModel; | ||
} | ||
} |
12 changes: 6 additions & 6 deletions
12
...teal/blockstates/deepslate_heart_ore.json → ...eal/blockstates_/deepslate_heart_ore.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "lifesteal:block/deepslate_heart_ore" | ||
} | ||
} | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "lifesteal:block/deepslate_heart_ore" | ||
} | ||
} | ||
} |
12 changes: 6 additions & 6 deletions
12
...sets/lifesteal/blockstates/heart_ore.json → ...ets/lifesteal/blockstates_/heart_ore.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "lifesteal:block/heart_ore" | ||
} | ||
} | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "lifesteal:block/heart_ore" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/main/resources/data/minecraft/tags/block/mineable/pickaxe.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"lifesteal:heart_ore", | ||
"lifesteal:deepslate_heart_ore" | ||
"lifesteal:block/heart_ore", | ||
"lifesteal:block/deepslate_heart_ore" | ||
] | ||
} |
4 changes: 2 additions & 2 deletions
4
src/main/resources/data/minecraft/tags/block/needs_diamond_tool.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"lifesteal:heart_ore", | ||
"lifesteal:deepslate_heart_ore" | ||
"lifesteal:block/heart_ore", | ||
"lifesteal:block/deepslate_heart_ore" | ||
] | ||
} |