Start patterns optimization
This commit is contained in:
parent
a21d50e00a
commit
f34774c54c
3 changed files with 72 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
<<<<<<< Updated upstream
|
||||||
package ru.betterend.blocks.basis;
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
@ -40,3 +41,53 @@ public class BlockBase extends Block implements BlockPatterned {
|
||||||
return Patterns.STATE_SIMPLE;
|
return Patterns.STATE_SIMPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
|
import ru.betterend.patterns.BlockPatterned;
|
||||||
|
import ru.betterend.patterns.Patterns;
|
||||||
|
|
||||||
|
public class BlockBase extends Block implements BlockPatterned {
|
||||||
|
public BlockBase(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
|
return Collections.singletonList(new ItemStack(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockModel getBlockModel(BlockState state) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStatesPattern(Reader data) {
|
||||||
|
String block = Registry.BLOCK.getKey(this).getPath();
|
||||||
|
return Patterns.createJson(data, block, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModelPattern(String block) {
|
||||||
|
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||||
|
return Patterns.createJson(Patterns.BLOCK_BASE, blockId.getPath(), block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation statePatternId() {
|
||||||
|
return Patterns.STATE_SIMPLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>>>>>>> Stashed changes
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<<<<<<< Updated upstream
|
||||||
package ru.betterend.patterns;
|
package ru.betterend.patterns;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
@ -12,3 +13,22 @@ public interface BlockPatterned extends Patterned {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
package ru.betterend.patterns;
|
||||||
|
|
||||||
|
import java.io.Reader;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
|
public interface BlockPatterned extends Patterned {
|
||||||
|
BlockModel getBlockModel(BlockState state);
|
||||||
|
default String getStatesPattern(Reader data) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
default ResourceLocation statePatternId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>>>>>>> Stashed changes
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package ru.betterend.patterns;
|
package ru.betterend.patterns;
|
||||||
|
|
||||||
public interface Patterned {
|
public interface Patterned {
|
||||||
default String getModelPattern(String name) {
|
String getModelPattern(String name);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue