Tests
This commit is contained in:
parent
086657198e
commit
807e25c907
3 changed files with 22 additions and 5 deletions
|
@ -24,10 +24,10 @@ public class BlockBase extends Block implements BlockPatterned {
|
||||||
return Collections.singletonList(new ItemStack(this));
|
return Collections.singletonList(new ItemStack(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public BlockModel getBlockModel(BlockState state) {
|
// public BlockModel getBlockModel(BlockState state) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatesPattern(Reader data) {
|
public String getStatesPattern(Reader data) {
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.io.Reader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.resources.model.UnbakedModel;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
@ -31,6 +33,21 @@ public class ModelLoaderMixin {
|
||||||
@Shadow
|
@Shadow
|
||||||
private ResourceManager resourceManager;
|
private ResourceManager resourceManager;
|
||||||
|
|
||||||
|
@Inject(method = "getModel", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void be_registerModel(ResourceLocation resourceLocation, CallbackInfoReturnable<UnbakedModel> info) {
|
||||||
|
if (resourceLocation.getNamespace().equals(BetterEnd.MOD_ID)) {
|
||||||
|
if (resourceLocation instanceof ModelResourceLocation) {
|
||||||
|
ModelResourceLocation modelId = (ModelResourceLocation) resourceLocation;
|
||||||
|
String variant = modelId.getVariant();
|
||||||
|
if (variant.equals("inventory")) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
System.out.println(modelId.getVariant());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "loadBlockModel", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "loadBlockModel", at = @At("HEAD"), cancellable = true)
|
||||||
private void be_loadModelPattern(ResourceLocation id, CallbackInfoReturnable<BlockModel> info) {
|
private void be_loadModelPattern(ResourceLocation id, CallbackInfoReturnable<BlockModel> info) {
|
||||||
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
|
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
public interface BlockPatterned extends Patterned {
|
public interface BlockPatterned extends Patterned {
|
||||||
BlockModel getBlockModel(BlockState state);
|
//BlockModel getBlockModel(BlockState state);
|
||||||
default String getStatesPattern(Reader data) {
|
default String getStatesPattern(Reader data) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue