use of net.minecraft.item.ItemBase in project StationAPI by ModificationStation.
the class TagItemInit method addItemIgnoreDamage.
private static void addItemIgnoreDamage(String oreDictString, ItemBase itemBase) {
ItemInstance itemInstanceToUse = new ItemInstance(itemBase);
TagRegistry.INSTANCE.register(new TagEntry(new ItemInstance(itemBase), itemInstance -> itemInstanceToUse.itemId == itemInstance.itemId, Identifier.of(oreDictString)));
}
use of net.minecraft.item.ItemBase in project StationAPI by ModificationStation.
the class ModelOverride method matches.
boolean matches(ItemInstance stack, @Nullable ClientLevel world, @Nullable Living entity) {
ItemBase item = stack.getType();
Iterator<Entry<Identifier, Float>> var5 = this.predicateToThresholds.entrySet().iterator();
Entry<Identifier, Float> entry;
ModelPredicateProvider modelPredicateProvider;
if (!var5.hasNext()) {
return true;
}
entry = var5.next();
modelPredicateProvider = ModelPredicateProviderRegistry.INSTANCE.get(item, entry.getKey());
while (modelPredicateProvider != null && modelPredicateProvider.call(stack, world, entity) >= entry.getValue()) {
if (!var5.hasNext()) {
return true;
}
entry = var5.next();
modelPredicateProvider = ModelPredicateProviderRegistry.INSTANCE.get(item, entry.getKey());
}
return false;
}
use of net.minecraft.item.ItemBase in project StationAPI by ModificationStation.
the class BlockRegistry method setSize.
@Override
protected boolean setSize(int newSize) {
if (!super.setSize(newSize)) {
int oldSize = getSize();
BlockBaseAccessor.stationapi$setById(Arrays.copyOf(BlockBase.BY_ID, newSize));
BlockBaseAccessor.stationapi$setTicksRandomly(Arrays.copyOf(BlockBase.TICKS_RANDOMLY, newSize));
BlockBaseAccessor.stationapi$setFullOpaque(Arrays.copyOf(BlockBase.FULL_OPAQUE, newSize));
BlockBaseAccessor.stationapi$setHasTileEntity(Arrays.copyOf(BlockBase.HAS_TILE_ENTITY, newSize));
BlockBaseAccessor.stationapi$setLightOpacity(Arrays.copyOf(BlockBase.LIGHT_OPACITY, newSize));
BlockBaseAccessor.stationapi$setAllowsGrassUnder(Arrays.copyOf(BlockBase.ALLOWS_GRASS_UNDER, newSize));
BlockBaseAccessor.stationapi$setEmittance(Arrays.copyOf(BlockBase.EMITTANCE, newSize));
BlockBaseAccessor.stationapi$setNoNotifyOnMetaChange(Arrays.copyOf(BlockBase.NO_NOTIFY_ON_META_CHANGE, newSize));
ItemBase[] oldItems = ItemBase.byId.clone();
for (int i = oldSize; i < oldItems.length; i++) {
ItemBase item = oldItems[i];
if (item != null) {
ItemBase.byId[i] = null;
int newId = i - oldSize + newSize;
((ItemBaseAccessor) item).setId(newId);
(newId < ItemBase.byId.length ? ItemBase.byId : (ItemBase.byId = Arrays.copyOf(ItemBase.byId, MathHelper.isPowerOfTwo(newId + 1) ? newId + 1 : MathHelper.smallestEncompassingPowerOfTwo(newId))))[newId] = item;
}
}
}
return true;
}
Aggregations