add item command, remove legacy ids

This commit is contained in:
Sen 2025-06-12 12:28:37 +02:00
parent 678f37e184
commit 1dea7e9645
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
38 changed files with 272 additions and 197 deletions

View file

@ -1926,7 +1926,7 @@ public class Client implements IThreadListener {
}
StringBuilder str = new StringBuilder(
"Schaue auf: " + BlockRegistry.REGISTRY.getNameForObject(block.getBlock()) + " [" + BlockRegistry.getIdFromBlock(block.getBlock()) +
"Schaue auf: " + BlockRegistry.getNameFromBlock(block.getBlock()) + " [" + BlockRegistry.getIdFromBlock(block.getBlock()) +
":" + block.getBlock().getMetaFromState(block) + "]" + "\n" +
String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ())
);
@ -1967,7 +1967,7 @@ public class Client implements IThreadListener {
: "Rüstung: n/a, Pfeile: n/a") + "\n" +
// ItemStack held = ((EntityLiving)entity).getHeldItem();
(held != null ?
"Gegens.: " + ItemRegistry.REGISTRY.getNameForObject(held.getItem()) + " x" + held.size + " (" + held.getMetadata() + ")" : "Gegens.: n/a") + "\n" +
"Gegens.: " + ItemRegistry.getNameFromItem(held.getItem()) + " x" + held.size + " (" + held.getMetadata() + ")" : "Gegens.: n/a") + "\n" +
"Eigens.: " + (entity.dead ? "D" : " ") + (entity.noClip ? "N" : " ") + (entity.onGround ? "G" : " ")
+ (entity.canBeCollidedWith() ? "C" : " ") + (entity.canBePushed() ? "P" : " ")
+ (entity.isBurning() ? "B" : " ") // + (entity.isInvisible() ? "I" : " ") // + (entity.isSilent() ? "S" : " ")

View file

@ -408,7 +408,7 @@ public class BlockRenderer
TextureMap texturemap = Client.CLIENT.getTextureMapBlocks();
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
BlockLiquid block = FluidRegistry.getStaticBlock(z);
String name = BlockRegistry.REGISTRY.getNameForObject(block).toString();
String name = BlockRegistry.getNameFromBlock(block).toString();
TextureAtlasSprite[] sprites = new TextureAtlasSprite[] {texturemap.getAtlasSprite("blocks/" + name + "_still"), texturemap.getAtlasSprite("blocks/" + name + "_flow")};
this.fluids.put(FluidRegistry.getFluidBlock(z), sprites);
this.fluids.put(block, sprites);

View file

@ -83,13 +83,13 @@ public class ItemModelMesher
// public void registerItem(Item itm, int subType, String identifier)
// {
// this.register(itm, subType, new ResourceLocation(identifier, "inventory"));
//// String id = ItemRegistry.REGISTRY.getNameForObject(itm).toString();
//// String id = ItemRegistry.getNameFromItem(itm).toString();
//// if(id.equals(identifier)) {
////// throw new IllegalArgumentException("Duplikat: " + identifier);
//// Log.DATA.info("MATCHING: " + ItemRegistry.REGISTRY.getNameForObject(itm) + ":" + subType);
//// Log.DATA.info("MATCHING: " + ItemRegistry.getNameFromItem(itm) + ":" + subType);
//// }
//// else {
//// Log.DATA.info("MISMATCH: " + ItemRegistry.REGISTRY.getNameForObject(itm) + ":" + subType + ": " + identifier);
//// Log.DATA.info("MISMATCH: " + ItemRegistry.getNameFromItem(itm) + ":" + subType + ": " + identifier);
//// }
// }
@ -124,7 +124,7 @@ public class ItemModelMesher
for(ItemStack stack : stacks) {
this.simpleShapesCache.put(this.getIndex(item, stack.getMetadata()),
this.modelManager.getModel("item/" +
ItemRegistry.REGISTRY.getNameForObject(item).toString() + "#" + stack.getMetadata() + '#' + "inventory"));
ItemRegistry.getNameFromItem(item).toString() + "#" + stack.getMetadata() + '#' + "inventory"));
}
stacks.clear();
}

View file

@ -42,7 +42,7 @@ public abstract class ModelBakery
static {
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
String name = BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(z)).toString();
String name = BlockRegistry.getNameFromBlock(FluidRegistry.getStaticBlock(z)).toString();
LOCATIONS_BUILTIN_TEXTURES.add("blocks/" + name + "_flow");
LOCATIONS_BUILTIN_TEXTURES.add("blocks/" + name + "_still");
}
@ -63,7 +63,7 @@ public abstract class ModelBakery
models.put(MISSING, (ModelBlock)new ModelBlock(null).add().all());
variants.add(MISSING);
for(Entry<State, String> entry : map.entrySet()) {
ModelBlock model = (ModelBlock)entry.getKey().getBlock().getModel(ModelBlock.PROVIDER, BlockRegistry.REGISTRY.getNameForObject(entry.getKey().getBlock())
ModelBlock model = (ModelBlock)entry.getKey().getBlock().getModel(ModelBlock.PROVIDER, BlockRegistry.getNameFromBlock(entry.getKey().getBlock())
.toString(), entry.getKey());
// ResourceLocation blk = new ResourceLocation(entry.getValue().getName());
models.put(entry.getValue(), model);
@ -144,8 +144,8 @@ public abstract class ModelBakery
// {
item.getRenderItems(item, stacks);
for(ItemStack stack : stacks) {
String resourcelocation = "item/" + ItemRegistry.REGISTRY.getNameForObject(item).toString() + "#" + stack.getMetadata() + '#' + "inventory";
models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.REGISTRY.getNameForObject(item).toString(), stack.getMetadata()));
String resourcelocation = "item/" + ItemRegistry.getNameFromItem(item).toString() + "#" + stack.getMetadata() + '#' + "inventory";
models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getNameFromItem(item).toString(), stack.getMetadata()));
itemLocations.add(resourcelocation);
}
stacks.clear();

View file

@ -33,7 +33,7 @@ public class ModelManager
for(Block block : BlockRegistry.REGISTRY) {
if(block.getRenderType() != 3) {
this.builtin.add(block);
// Log.info("Builtin: " + BlockRegistry.REGISTRY.getNameForObject(block));
// Log.info("Builtin: " + BlockRegistry.getNameFromBlock(block));
}
else {
IProperty<?>[] ignored = block.getIgnoredProperties();
@ -109,7 +109,7 @@ public class ModelManager
{
String texture = this.liquidMap.get(block);
if(texture == null)
this.liquidMap.put(block, texture = "blocks/" + BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(FluidRegistry.getFluidMeta((BlockLiquid)block))) + "_still");
this.liquidMap.put(block, texture = "blocks/" + BlockRegistry.getNameFromBlock(FluidRegistry.getStaticBlock(FluidRegistry.getFluidMeta((BlockLiquid)block))) + "_still");
return this.texMap.getAtlasSprite(texture);
}
}

View file

@ -30,7 +30,7 @@ public class MultiStateMap extends StateMap
if (this.name == null)
{
s = BlockRegistry.REGISTRY.getNameForObject(state.getBlock());
s = BlockRegistry.getNameFromBlock(state.getBlock());
}
else
{

View file

@ -8,6 +8,6 @@ public class SingleStateMap extends StateMap
{
protected String getResourceLocation(State state)
{
return BlockRegistry.REGISTRY.getNameForObject(state.getBlock()).toString() + '#' + this.getPropertyString(state.getProperties());
return BlockRegistry.getNameFromBlock(state.getBlock()).toString() + '#' + this.getPropertyString(state.getProperties());
}
}

View file

@ -45,9 +45,9 @@ public class TextureMap extends Texture
block.getAnimatedTextures(map);
}
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
map.put("blocks/" + BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(z)) + "_still",
map.put("blocks/" + BlockRegistry.getNameFromBlock(FluidRegistry.getStaticBlock(z)) + "_still",
FluidRegistry.getStaticAnim(z));
map.put("blocks/" + BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(z)) + "_flow",
map.put("blocks/" + BlockRegistry.getNameFromBlock(FluidRegistry.getStaticBlock(z)) + "_flow",
FluidRegistry.getFluidAnim(z));
}
for(Entry<String, Object> entry : map.entrySet()) {