mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 11:49:37 +00:00
some subtile/te work
This commit is contained in:
1 parent
c79f9f7704
commit
a5625750b7
40 files changed
+381
-400
No files matched your search
@@ -98,8 +98,8 @@ public final class BotaniaAPI {
|
||||
public static final Set<ResourceLocation> subtilesForCreativeMenu = new LinkedHashSet<>();
|
||||
public static final BiMap<ResourceLocation, ResourceLocation> miniFlowers = HashBiMap.create();
|
||||
|
||||
public static final Map<String, Integer> oreWeights = new HashMap<>();
|
||||
public static final Map<String, Integer> oreWeightsNether = new HashMap<>();
|
||||
public static final Map<ResourceLocation, Integer> oreWeights = new HashMap<>();
|
||||
public static final Map<ResourceLocation, Integer> oreWeightsNether = new HashMap<>();
|
||||
|
||||
public static final Set<Item> looniumBlacklist = new LinkedHashSet<>();
|
||||
public static final Map<Block, EnumProperty<EnumDyeColor>> paintableBlocks = new LinkedHashMap<>();
|
||||
@@ -749,36 +749,33 @@ public final class BotaniaAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps an ore (ore dictionary key) to it's weight on the world generation. This
|
||||
* Maps a block tag to it's weight on the world generation. This
|
||||
* is used for the Orechid flower. Check the static block in the BotaniaAPI class
|
||||
* to get the weights for the vanilla blocks.<br>
|
||||
* Alternatively get the values with the OreDetector mod:<br>
|
||||
* https://gist.github.com/Vazkii/9493322
|
||||
*/
|
||||
public static void addOreWeight(String ore, int weight) {
|
||||
oreWeights.put(ore, weight);
|
||||
public static void addOreWeight(ResourceLocation tag, int weight) {
|
||||
oreWeights.put(tag, weight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps an ore (ore dictionary key) to it's weight on the nether world generation. This
|
||||
* Maps a block tag to it's weight on the nether world generation. This
|
||||
* is used for the Orechid Ignem flower. Check the static block in the BotaniaAPI class
|
||||
* to get the weights for the vanilla blocks.<br>
|
||||
* Alternatively get the values with the OreDetector mod:<br>
|
||||
* https://gist.github.com/Vazkii/9493322
|
||||
*/
|
||||
public static void addOreWeightNether(String ore, int weight) {
|
||||
if(ore.contains("Nether") && OreDictionary.getOres(ore.replace("Nether", "")).size() == 0)
|
||||
return;
|
||||
|
||||
oreWeightsNether.put(ore, weight);
|
||||
public static void addOreWeightNether(ResourceLocation tag, int weight) {
|
||||
oreWeightsNether.put(tag, weight);
|
||||
}
|
||||
|
||||
public static int getOreWeight(String ore) {
|
||||
return oreWeights.get(ore);
|
||||
public static int getOreWeight(ResourceLocation tag) {
|
||||
return oreWeights.get(tag);
|
||||
}
|
||||
|
||||
public static int getOreWeightNether(String ore) {
|
||||
return oreWeightsNether.get(ore);
|
||||
public static int getOreWeightNether(ResourceLocation tag) {
|
||||
return oreWeightsNether.get(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -149,10 +149,10 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {}
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name) {}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {}
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {}
|
||||
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e) {
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -104,10 +103,10 @@ public interface IInternalMethodHandler {
|
||||
public boolean hasSolegnoliaAround(Entity e);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res);
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound);
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound);
|
||||
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ package vazkii.botania.api.recipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package vazkii.botania.api.recipe;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -10,23 +10,15 @@ import java.util.List;
|
||||
public class RecipeElvenTrade {
|
||||
|
||||
private final ImmutableList<ItemStack> outputs;
|
||||
private final ImmutableList<Object> inputs;
|
||||
private final ImmutableList<Ingredient> inputs;
|
||||
|
||||
public RecipeElvenTrade(ItemStack[] outputs, Object... inputs) {
|
||||
public RecipeElvenTrade(ItemStack[] outputs, Ingredient... inputs) {
|
||||
this.outputs = ImmutableList.copyOf(outputs);
|
||||
|
||||
ImmutableList.Builder<Object> inputsToSet = ImmutableList.builder();
|
||||
for(Object obj : inputs) {
|
||||
if(obj instanceof String || obj instanceof ItemStack)
|
||||
inputsToSet.add(obj);
|
||||
else throw new IllegalArgumentException("Invalid input");
|
||||
}
|
||||
|
||||
this.inputs = inputsToSet.build();
|
||||
this.inputs = ImmutableList.copyOf(inputs);
|
||||
}
|
||||
|
||||
public boolean matches(List<ItemStack> stacks, boolean remove) {
|
||||
List<Object> inputsMissing = new ArrayList<>(inputs);
|
||||
List<Ingredient> inputsMissing = new ArrayList<>(inputs);
|
||||
List<ItemStack> stacksToRemove = new ArrayList<>();
|
||||
|
||||
for(ItemStack stack : stacks) {
|
||||
@@ -36,37 +28,20 @@ public class RecipeElvenTrade {
|
||||
if(inputsMissing.isEmpty())
|
||||
break;
|
||||
|
||||
int stackIndex = -1, oredictIndex = -1;
|
||||
int stackIndex = -1;
|
||||
|
||||
for(int j = 0; j < inputsMissing.size(); j++) {
|
||||
Object input = inputsMissing.get(j);
|
||||
if(input instanceof String) {
|
||||
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
|
||||
boolean found = false;
|
||||
for(ItemStack ostack : validStacks) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false)) {
|
||||
if(!stacksToRemove.contains(stack))
|
||||
stacksToRemove.add(stack);
|
||||
oredictIndex = j;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(found)
|
||||
break;
|
||||
} else if(input instanceof ItemStack && simpleAreStacksEqual((ItemStack) input, stack)) {
|
||||
for (int i = 0; i < inputsMissing.size(); i++) {
|
||||
Ingredient ingr = inputsMissing.get(i);
|
||||
if (ingr.test(stack)) {
|
||||
if(!stacksToRemove.contains(stack))
|
||||
stacksToRemove.add(stack);
|
||||
stackIndex = j;
|
||||
stackIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(stackIndex != -1)
|
||||
inputsMissing.remove(stackIndex);
|
||||
else if(oredictIndex != -1)
|
||||
inputsMissing.remove(oredictIndex);
|
||||
}
|
||||
|
||||
if(remove)
|
||||
@@ -76,11 +51,7 @@ public class RecipeElvenTrade {
|
||||
return inputsMissing.isEmpty();
|
||||
}
|
||||
|
||||
private boolean simpleAreStacksEqual(ItemStack stack, ItemStack stack2) {
|
||||
return stack.getItem() == stack2.getItem() && stack.getItemDamage() == stack2.getItemDamage();
|
||||
}
|
||||
|
||||
public List<Object> getInputs() {
|
||||
public List<Ingredient> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@ package vazkii.botania.api.subtile;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -71,13 +70,13 @@ public class SubTileEntity {
|
||||
}
|
||||
|
||||
public final void writeToPacketNBTInternal(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_TICKS_EXISTED, ticksExisted);
|
||||
cmp.putInt(TAG_TICKS_EXISTED, ticksExisted);
|
||||
writeToPacketNBT(cmp);
|
||||
}
|
||||
|
||||
public final void readFromPacketNBTInternal(NBTTagCompound cmp) {
|
||||
if(cmp.hasKey(TAG_TICKS_EXISTED))
|
||||
ticksExisted = cmp.getInteger(TAG_TICKS_EXISTED);
|
||||
if(cmp.contains(TAG_TICKS_EXISTED))
|
||||
ticksExisted = cmp.getInt(TAG_TICKS_EXISTED);
|
||||
readFromPacketNBT(cmp);
|
||||
}
|
||||
|
||||
@@ -213,7 +212,7 @@ public class SubTileEntity {
|
||||
* Used to render a HUD portraying some data from this sub tile.
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {}
|
||||
public void renderHUD(Minecraft mc) {}
|
||||
|
||||
/**
|
||||
* Gets the light value for this SubTileEntity, this is a int (-1 to default to the flower)
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package vazkii.botania.api.subtile;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -20,7 +19,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
@@ -76,7 +75,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
|
||||
if(acceptsRedstone()) {
|
||||
redstoneSignal = 0;
|
||||
for(EnumFacing dir : EnumFacing.VALUES) {
|
||||
for(EnumFacing dir : EnumFacing.BY_INDEX) {
|
||||
int redstoneSide = supertile.getWorld().getRedstonePower(supertile.getPos().offset(dir), dir);
|
||||
redstoneSignal = Math.max(redstoneSignal, redstoneSide);
|
||||
}
|
||||
@@ -100,7 +99,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
if(supertile.getWorld().isBlockLoaded(cachedPoolCoordinates)) {
|
||||
needsNew = true;
|
||||
TileEntity tileAt = supertile.getWorld().getTileEntity(cachedPoolCoordinates);
|
||||
if(tileAt != null && tileAt instanceof IManaPool && !tileAt.isInvalid()) {
|
||||
if(tileAt != null && tileAt instanceof IManaPool && !tileAt.isRemoved()) {
|
||||
linkedPool = tileAt;
|
||||
needsNew = false;
|
||||
}
|
||||
@@ -137,7 +136,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
return false;
|
||||
|
||||
knownMana = mana;
|
||||
SoundEvent evt = ForgeRegistries.SOUND_EVENTS.getValue(DING_SOUND_EVENT);
|
||||
SoundEvent evt = IRegistry.SOUND_EVENT.get(DING_SOUND_EVENT);
|
||||
if(evt != null)
|
||||
player.playSound(evt, 0.1F, 1F);
|
||||
|
||||
@@ -154,31 +153,31 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
mana = cmp.getInteger(TAG_MANA);
|
||||
mana = cmp.getInt(TAG_MANA);
|
||||
|
||||
int x = cmp.getInteger(TAG_POOL_X);
|
||||
int y = cmp.getInteger(TAG_POOL_Y);
|
||||
int z = cmp.getInteger(TAG_POOL_Z);
|
||||
int x = cmp.getInt(TAG_POOL_X);
|
||||
int y = cmp.getInt(TAG_POOL_Y);
|
||||
int z = cmp.getInt(TAG_POOL_Z);
|
||||
|
||||
cachedPoolCoordinates = y < 0 ? null : new BlockPos(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_MANA, mana);
|
||||
cmp.putInt(TAG_MANA, mana);
|
||||
|
||||
if(cachedPoolCoordinates != null) {
|
||||
cmp.setInteger(TAG_POOL_X, cachedPoolCoordinates.getX());
|
||||
cmp.setInteger(TAG_POOL_Y, cachedPoolCoordinates.getY());
|
||||
cmp.setInteger(TAG_POOL_Z, cachedPoolCoordinates.getZ());
|
||||
cmp.putInt(TAG_POOL_X, cachedPoolCoordinates.getX());
|
||||
cmp.putInt(TAG_POOL_Y, cachedPoolCoordinates.getY());
|
||||
cmp.putInt(TAG_POOL_Z, cachedPoolCoordinates.getZ());
|
||||
} else {
|
||||
int x = linkedPool == null ? 0 : linkedPool.getPos().getX();
|
||||
int y = linkedPool == null ? -1 : linkedPool.getPos().getY();
|
||||
int z = linkedPool == null ? 0 : linkedPool.getPos().getZ();
|
||||
|
||||
cmp.setInteger(TAG_POOL_X, x);
|
||||
cmp.setInteger(TAG_POOL_Y, y);
|
||||
cmp.setInteger(TAG_POOL_Z, z);
|
||||
cmp.putInt(TAG_POOL_X, x);
|
||||
cmp.putInt(TAG_POOL_Y, y);
|
||||
cmp.putInt(TAG_POOL_Z, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,15 +211,15 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
}
|
||||
|
||||
public boolean isValidBinding() {
|
||||
return linkedPool != null && linkedPool.hasWorld() && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
|
||||
return linkedPool != null && linkedPool.hasWorld() && !linkedPool.isRemoved() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
public void renderHUD(Minecraft mc) {
|
||||
String name = I18n.format("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
int color = getColor();
|
||||
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
|
||||
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@ package vazkii.botania.api.subtile;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -25,8 +24,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
@@ -86,7 +85,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
if(acceptsRedstone()) {
|
||||
redstoneSignal = 0;
|
||||
for(EnumFacing dir : EnumFacing.VALUES) {
|
||||
for(EnumFacing dir : EnumFacing.BY_INDEX) {
|
||||
int redstoneSide = supertile.getWorld().getRedstonePower(supertile.getPos().offset(dir), dir);
|
||||
redstoneSignal = Math.max(redstoneSignal, redstoneSide);
|
||||
}
|
||||
@@ -111,9 +110,9 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
if(passive && muhBalance > 0 && passiveDecayTicks > muhBalance) {
|
||||
IBlockState state = supertile.getWorld().getBlockState(supertile.getPos());
|
||||
supertile.getWorld().playEvent(2001, supertile.getPos(), Block.getStateId(state));
|
||||
if(supertile.getWorld().getBlockState(supertile.getPos().down()).isSideSolid(supertile.getWorld(), supertile.getPos().down(), EnumFacing.UP))
|
||||
supertile.getWorld().setBlockState(supertile.getPos(), Blocks.DEADBUSH.getDefaultState());
|
||||
else supertile.getWorld().setBlockToAir(supertile.getPos());
|
||||
if(Blocks.DEAD_BUSH.getDefaultState().isValidPosition(supertile.getWorld(), supertile.getPos()))
|
||||
supertile.getWorld().setBlockState(supertile.getPos(), Blocks.DEAD_BUSH.getDefaultState());
|
||||
else supertile.getWorld().removeBlock(supertile.getPos());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +130,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
if(supertile.getWorld().isBlockLoaded(cachedCollectorCoordinates)) {
|
||||
needsNew = true;
|
||||
TileEntity tileAt = supertile.getWorld().getTileEntity(cachedCollectorCoordinates);
|
||||
if(tileAt != null && tileAt instanceof IManaCollector && !tileAt.isInvalid()) {
|
||||
if(tileAt instanceof IManaCollector && !tileAt.isRemoved()) {
|
||||
linkedCollector = tileAt;
|
||||
needsNew = false;
|
||||
}
|
||||
@@ -140,7 +139,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
}
|
||||
} else {
|
||||
TileEntity tileAt = supertile.getWorld().getTileEntity(linkedCollector.getPos());
|
||||
if(tileAt != null && tileAt instanceof IManaCollector)
|
||||
if(tileAt instanceof IManaCollector)
|
||||
linkedCollector = tileAt;
|
||||
}
|
||||
|
||||
@@ -204,10 +203,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
if(isPassiveFlower() && ticksExisted > 0 && BotaniaAPI.internalHandler.getPassiveFlowerDecay() > 0) {
|
||||
ItemStack drop = drops.get(0);
|
||||
if(!drop.isEmpty()) {
|
||||
if(!drop.hasTagCompound())
|
||||
drop.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound cmp = drop.getTagCompound();
|
||||
cmp.setInteger(TAG_PASSIVE_DECAY_TICKS, passiveDecayTicks);
|
||||
drop.getOrCreateTag().putInt(TAG_PASSIVE_DECAY_TICKS, passiveDecayTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,8 +212,8 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
if(isPassiveFlower()) {
|
||||
NBTTagCompound cmp = stack.getTagCompound();
|
||||
passiveDecayTicks = cmp.getInteger(TAG_PASSIVE_DECAY_TICKS);
|
||||
NBTTagCompound cmp = stack.getTag();
|
||||
passiveDecayTicks = cmp.getInt(TAG_PASSIVE_DECAY_TICKS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +226,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
sync();
|
||||
|
||||
knownMana = mana;
|
||||
SoundEvent evt = ForgeRegistries.SOUND_EVENTS.getValue(DING_SOUND_EVENT);
|
||||
SoundEvent evt = IRegistry.SOUND_EVENT.get(DING_SOUND_EVENT);
|
||||
if(evt != null)
|
||||
player.playSound(evt, 0.1F, 1F);
|
||||
|
||||
@@ -247,34 +243,34 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
mana = cmp.getInteger(TAG_MANA);
|
||||
passiveDecayTicks = cmp.getInteger(TAG_PASSIVE_DECAY_TICKS);
|
||||
mana = cmp.getInt(TAG_MANA);
|
||||
passiveDecayTicks = cmp.getInt(TAG_PASSIVE_DECAY_TICKS);
|
||||
|
||||
int x = cmp.getInteger(TAG_COLLECTOR_X);
|
||||
int y = cmp.getInteger(TAG_COLLECTOR_Y);
|
||||
int z = cmp.getInteger(TAG_COLLECTOR_Z);
|
||||
int x = cmp.getInt(TAG_COLLECTOR_X);
|
||||
int y = cmp.getInt(TAG_COLLECTOR_Y);
|
||||
int z = cmp.getInt(TAG_COLLECTOR_Z);
|
||||
|
||||
cachedCollectorCoordinates = y < 0 ? null : new BlockPos(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_MANA, mana);
|
||||
cmp.setInteger(TAG_TICKS_EXISTED, ticksExisted);
|
||||
cmp.setInteger(TAG_PASSIVE_DECAY_TICKS, passiveDecayTicks);
|
||||
cmp.putInt(TAG_MANA, mana);
|
||||
cmp.putInt(TAG_TICKS_EXISTED, ticksExisted);
|
||||
cmp.putInt(TAG_PASSIVE_DECAY_TICKS, passiveDecayTicks);
|
||||
|
||||
if(cachedCollectorCoordinates != null) {
|
||||
cmp.setInteger(TAG_COLLECTOR_X, cachedCollectorCoordinates.getX());
|
||||
cmp.setInteger(TAG_COLLECTOR_Y, cachedCollectorCoordinates.getY());
|
||||
cmp.setInteger(TAG_COLLECTOR_Z, cachedCollectorCoordinates.getZ());
|
||||
cmp.putInt(TAG_COLLECTOR_X, cachedCollectorCoordinates.getX());
|
||||
cmp.putInt(TAG_COLLECTOR_Y, cachedCollectorCoordinates.getY());
|
||||
cmp.putInt(TAG_COLLECTOR_Z, cachedCollectorCoordinates.getZ());
|
||||
} else {
|
||||
int x = linkedCollector == null ? 0 : linkedCollector.getPos().getX();
|
||||
int y = linkedCollector == null ? -1 : linkedCollector.getPos().getY();
|
||||
int z = linkedCollector == null ? 0 : linkedCollector.getPos().getZ();
|
||||
|
||||
cmp.setInteger(TAG_COLLECTOR_X, x);
|
||||
cmp.setInteger(TAG_COLLECTOR_Y, y);
|
||||
cmp.setInteger(TAG_COLLECTOR_Z, z);
|
||||
cmp.putInt(TAG_COLLECTOR_X, x);
|
||||
cmp.putInt(TAG_COLLECTOR_Y, y);
|
||||
cmp.putInt(TAG_COLLECTOR_Z, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,15 +305,15 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
|
||||
public boolean isValidBinding() {
|
||||
return linkedCollector != null && !linkedCollector.isInvalid() && supertile.getWorld().getTileEntity(linkedCollector.getPos()) == linkedCollector;
|
||||
return linkedCollector != null && !linkedCollector.isRemoved() && supertile.getWorld().getTileEntity(linkedCollector.getPos()) == linkedCollector;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
public void renderHUD(Minecraft mc) {
|
||||
String name = I18n.format("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
int color = getColor();
|
||||
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
|
||||
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,8 +12,9 @@ package vazkii.botania.api.subtile.signature;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -66,8 +67,8 @@ public class BasicSignature implements SubTileSignature {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void addTooltip(ItemStack stack, World world, List<String> tooltip) {
|
||||
tooltip.add(TextFormatting.BLUE + I18n.translateToLocal(getType()));
|
||||
public void addTooltip(ItemStack stack, World world, List<ITextComponent> tooltip) {
|
||||
tooltip.add(new TextComponentTranslation(getType()).applyTextStyle(TextFormatting.BLUE));
|
||||
}
|
||||
|
||||
private String unlocalizedName(String end) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.api.subtile.signature;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -40,6 +41,6 @@ public interface SubTileSignature {
|
||||
* Adds additional text to the tooltip. This text is added after getUnlocalizedLoreTextForStack.
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
default void addTooltip(ItemStack stack, World world, List<String> tooltip) {}
|
||||
default void addTooltip(ItemStack stack, World world, List<ITextComponent> tooltip) {}
|
||||
|
||||
}
|
||||
@@ -14,11 +14,11 @@ import com.google.common.collect.Table;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.block.model.ModelManager;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.ModelManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
@@ -56,7 +56,6 @@ import java.util.Random;
|
||||
|
||||
public class FloatingFlowerModel implements IBakedModel {
|
||||
|
||||
private static final String MUNDANE_PREFIX = "shimmeringFlower_";
|
||||
private final Table<IFloatingFlower.IslandType, ResourceLocation, CompositeBakedModel> CACHE = HashBasedTable.create();
|
||||
|
||||
protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) {
|
||||
@@ -121,7 +120,7 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
|
||||
IBakedModel flowerModel;
|
||||
|
||||
if(identifier.getPath().startsWith(MUNDANE_PREFIX)) {
|
||||
if(identifier.getPath().contains(MUNDANE_PREFIX)) {
|
||||
int meta = Integer.parseInt(identifier.getPath().substring(identifier.getPath().indexOf(MUNDANE_PREFIX) + MUNDANE_PREFIX.length()));
|
||||
flowerModel = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getItemModel(new ItemStack(ModBlocks.shinyFlower, 1, meta));
|
||||
} else {
|
||||
@@ -226,7 +225,7 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
identifier = ItemBlockSpecialFlower.getType(stack);
|
||||
} else {
|
||||
// Mundane flower
|
||||
identifier = new ResourceLocation(LibMisc.MOD_ID, MUNDANE_PREFIX + stack.getItemDamage());
|
||||
identifier = stack.getItem().getRegistryName();
|
||||
}
|
||||
|
||||
return FloatingFlowerModel.this.getModel(islandType, identifier);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IGrowab
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void animateTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
int hex = this.color.getColorValue();
|
||||
int hex = this.color.colorValue;
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = hex & 0xFF;
|
||||
|
||||
@@ -802,60 +802,61 @@ public final class ModBlocks {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void initTileEntities(RegistryEvent.Register<TileEntityType<?>> evt) {
|
||||
TileEntityType.Builder.create(TileAltar::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ALTAR);
|
||||
TileEntityType.Builder.create(TileSpecialFlower::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPECIAL_FLOWER);
|
||||
TileEntityType.Builder.create(TileSpreader::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPREADER);
|
||||
TileEntityType.Builder.create(TilePool::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.POOL);
|
||||
TileEntityType.Builder.create(TileRuneAltar::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RUNE_ALTAR);
|
||||
TileEntityType.Builder.create(TilePylon::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PYLON);
|
||||
TileEntityType.Builder.create(TileDistributor::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.DISTRIBUTOR);
|
||||
TileEntityType.Builder.create(TileManaVoid::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_VOID);
|
||||
TileEntityType.Builder.create(TileManaDetector::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_DETECTOR);
|
||||
TileEntityType.Builder.create(TileEnchanter::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ENCHANTER);
|
||||
TileEntityType.Builder.create(TileTurntable::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TURNTABLE);
|
||||
TileEntityType.Builder.create(TileTinyPlanet::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TINY_PLANET);
|
||||
TileEntityType.Builder.create(TileOpenCrate::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.OPEN_CRATE);
|
||||
TileEntityType.Builder.create(TileCraftCrate::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CRAFT_CRATE);
|
||||
TileEntityType.Builder.create(TileForestEye::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.FOREST_EYE);
|
||||
TileEntityType.Builder.create(TilePlatform::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PLATFORM);
|
||||
TileEntityType.Builder.create(TileAlfPortal::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ALF_PORTAL);
|
||||
TileEntityType.Builder.create(TileBifrost::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BIFROST);
|
||||
TileEntityType.Builder.create(TileFloatingFlower::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MINI_ISLAND);
|
||||
TileEntityType.Builder.create(TileTinyPotato::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TINY_POTATO);
|
||||
TileEntityType.Builder.create(TileSpawnerClaw::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPAWNER_CLAW);
|
||||
TileEntityType.Builder.create(TileEnderEye::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ENDER_EYE_BLOCK);
|
||||
TileEntityType.Builder.create(TileStarfield::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.STARFIELD);
|
||||
TileEntityType.Builder.create(TileRFGenerator::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RF_GENERATOR);
|
||||
TileEntityType.Builder.create(TileBrewery::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BREWERY);
|
||||
TileEntityType.Builder.create(TileTerraPlate::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TERRA_PLATE);
|
||||
TileEntityType.Builder.create(TileRedStringContainer::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_CONTAINER);
|
||||
TileEntityType.Builder.create(TileRedStringDispenser::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_DISPENSER);
|
||||
TileEntityType.Builder.create(TileRedStringFertilizer::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_FERTILIZER);
|
||||
TileEntityType.Builder.create(TileRedStringComparator::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_COMPARATOR);
|
||||
TileEntityType.Builder.create(TileRedStringRelay::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_RELAY);
|
||||
TileEntityType.Builder.create(TileFloatingSpecialFlower::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.FLOATING_SPECIAL_FLOWER);
|
||||
TileEntityType.Builder.create(TileManaFlame::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_FLAME);
|
||||
TileEntityType.Builder.create(TilePrism::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PRISM);
|
||||
TileEntityType.Builder.create(TileCorporeaIndex::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_INDEX);
|
||||
TileEntityType.Builder.create(TileCorporeaFunnel::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_FUNNEL);
|
||||
TileEntityType.Builder.create(TilePump::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PUMP);
|
||||
TileEntityType.Builder.create(TileFakeAir::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.FAKE_AIR);
|
||||
TileEntityType.Builder.create(TileCorporeaInterceptor::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_INTERCEPTOR);
|
||||
TileEntityType.Builder.create(TileCorporeaCrystalCube::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_CRYSTAL_CUBE);
|
||||
TileEntityType.Builder.create(TileIncensePlate::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.INCENSE_PLATE);
|
||||
TileEntityType.Builder.create(TileHourglass::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.HOURGLASS);
|
||||
TileEntityType.Builder.create(TileSparkChanger::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPARK_CHANGER);
|
||||
TileEntityType.Builder.create(TileCocoon::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.COCOON);
|
||||
TileEntityType.Builder.create(TileLightRelay::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.LIGHT_RELAY);
|
||||
TileEntityType.Builder.create(TileCacophonium::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CACOPHONIUM);
|
||||
TileEntityType.Builder.create(TileBellows::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BELLOWS);
|
||||
TileEntityType.Builder.create(TileCell::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CELL_BLOCK);
|
||||
TileEntityType.Builder.create(TileRedStringInterceptor::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_INTERCEPTOR);
|
||||
TileEntityType.Builder.create(TileGaiaHead::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.GAIA_HEAD);
|
||||
TileEntityType.Builder.create(TileCorporeaRetainer::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_RETAINER);
|
||||
TileEntityType.Builder.create(TileTeruTeruBozu::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TERU_TERU_BOZU);
|
||||
TileEntityType.Builder.create(TileAvatar::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.AVATAR);
|
||||
TileEntityType.Builder.create(TileAnimatedTorch::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ANIMATED_TORCH);
|
||||
IForgeRegistry<TileEntityType<?>> r = evt.getRegistry();
|
||||
r.register(TileEntityType.Builder.create(TileAltar::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ALTAR));
|
||||
r.register(TileEntityType.Builder.create(TileSpecialFlower::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPECIAL_FLOWER));
|
||||
r.register(TileEntityType.Builder.create(TileSpreader::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPREADER));
|
||||
r.register(TileEntityType.Builder.create(TilePool::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.POOL));
|
||||
r.register(TileEntityType.Builder.create(TileRuneAltar::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RUNE_ALTAR));
|
||||
r.register(TileEntityType.Builder.create(TilePylon::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PYLON));
|
||||
r.register(TileEntityType.Builder.create(TileDistributor::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.DISTRIBUTOR));
|
||||
r.register(TileEntityType.Builder.create(TileManaVoid::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_VOID));
|
||||
r.register(TileEntityType.Builder.create(TileManaDetector::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_DETECTOR));
|
||||
r.register(TileEntityType.Builder.create(TileEnchanter::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ENCHANTER));
|
||||
r.register(TileEntityType.Builder.create(TileTurntable::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TURNTABLE));
|
||||
r.register(TileEntityType.Builder.create(TileTinyPlanet::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TINY_PLANET));
|
||||
r.register(TileEntityType.Builder.create(TileOpenCrate::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.OPEN_CRATE));
|
||||
r.register(TileEntityType.Builder.create(TileCraftCrate::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CRAFT_CRATE));
|
||||
r.register(TileEntityType.Builder.create(TileForestEye::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.FOREST_EYE));
|
||||
r.register(TileEntityType.Builder.create(TilePlatform::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PLATFORM));
|
||||
r.register(TileEntityType.Builder.create(TileAlfPortal::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ALF_PORTAL));
|
||||
r.register(TileEntityType.Builder.create(TileBifrost::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BIFROST));
|
||||
r.register(TileEntityType.Builder.create(TileFloatingFlower::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MINI_ISLAND));
|
||||
r.register(TileEntityType.Builder.create(TileTinyPotato::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TINY_POTATO));
|
||||
r.register(TileEntityType.Builder.create(TileSpawnerClaw::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPAWNER_CLAW));
|
||||
r.register(TileEntityType.Builder.create(TileEnderEye::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ENDER_EYE_BLOCK));
|
||||
r.register(TileEntityType.Builder.create(TileStarfield::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.STARFIELD));
|
||||
r.register(TileEntityType.Builder.create(TileRFGenerator::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RF_GENERATOR));
|
||||
r.register(TileEntityType.Builder.create(TileBrewery::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BREWERY));
|
||||
r.register(TileEntityType.Builder.create(TileTerraPlate::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TERRA_PLATE));
|
||||
r.register(TileEntityType.Builder.create(TileRedStringContainer::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_CONTAINER));
|
||||
r.register(TileEntityType.Builder.create(TileRedStringDispenser::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_DISPENSER));
|
||||
r.register(TileEntityType.Builder.create(TileRedStringFertilizer::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_FERTILIZER));
|
||||
r.register(TileEntityType.Builder.create(TileRedStringComparator::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_COMPARATOR));
|
||||
r.register(TileEntityType.Builder.create(TileRedStringRelay::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_RELAY));
|
||||
r.register(TileEntityType.Builder.create(TileFloatingSpecialFlower::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.FLOATING_SPECIAL_FLOWER));
|
||||
r.register(TileEntityType.Builder.create(TileManaFlame::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_FLAME));
|
||||
r.register(TileEntityType.Builder.create(TilePrism::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PRISM));
|
||||
r.register(TileEntityType.Builder.create(TileCorporeaIndex::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_INDEX));
|
||||
r.register(TileEntityType.Builder.create(TileCorporeaFunnel::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_FUNNEL));
|
||||
r.register(TileEntityType.Builder.create(TilePump::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PUMP));
|
||||
r.register(TileEntityType.Builder.create(TileFakeAir::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.FAKE_AIR));
|
||||
r.register(TileEntityType.Builder.create(TileCorporeaInterceptor::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_INTERCEPTOR));
|
||||
r.register(TileEntityType.Builder.create(TileCorporeaCrystalCube::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_CRYSTAL_CUBE));
|
||||
r.register(TileEntityType.Builder.create(TileIncensePlate::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.INCENSE_PLATE));
|
||||
r.register(TileEntityType.Builder.create(TileHourglass::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.HOURGLASS));
|
||||
r.register(TileEntityType.Builder.create(TileSparkChanger::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPARK_CHANGER));
|
||||
r.register(TileEntityType.Builder.create(TileCocoon::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.COCOON));
|
||||
r.register(TileEntityType.Builder.create(TileLightRelay::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.LIGHT_RELAY));
|
||||
r.register(TileEntityType.Builder.create(TileCacophonium::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CACOPHONIUM));
|
||||
r.register(TileEntityType.Builder.create(TileBellows::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BELLOWS));
|
||||
r.register(TileEntityType.Builder.create(TileCell::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CELL_BLOCK));
|
||||
r.register(TileEntityType.Builder.create(TileRedStringInterceptor::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_INTERCEPTOR));
|
||||
r.register(TileEntityType.Builder.create(TileGaiaHead::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.GAIA_HEAD));
|
||||
r.register(TileEntityType.Builder.create(TileCorporeaRetainer::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_RETAINER));
|
||||
r.register(TileEntityType.Builder.create(TileTeruTeruBozu::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TERU_TERU_BOZU));
|
||||
r.register(TileEntityType.Builder.create(TileAvatar::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.AVATAR));
|
||||
r.register(TileEntityType.Builder.create(TileAnimatedTorch::new).build(null).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ANIMATED_TORCH));
|
||||
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MANASTAR, SubTileManastar.class);
|
||||
@@ -910,18 +911,48 @@ public final class ModBlocks {
|
||||
BotaniaAPI.registerMiniSubTile(new ResourceLocation(key.getNamespace(), key.getPath() + "Chibi"), innerClazz, key);
|
||||
}
|
||||
|
||||
// This is a method returning fresh arrays to account for registry replacements
|
||||
private static Block[] getOrderedFlowers() {
|
||||
return new Block[] {
|
||||
whiteFlower, orangeFlower, magentaFlower, lightBlueFlower,
|
||||
yellowFlower, limeFlower, pinkFlower, grayFlower,
|
||||
lightGrayFlower, cyanFlower, purpleFlower, blueFlower,
|
||||
brownFlower, greenFlower, redFlower, blackFlower
|
||||
};
|
||||
public static Block getFlower(EnumDyeColor color) {
|
||||
switch (color) {
|
||||
default:
|
||||
case WHITE: return whiteFlower;
|
||||
case ORANGE: return orangeFlower;
|
||||
case MAGENTA: return magentaFlower;
|
||||
case LIGHT_BLUE: return lightBlueFlower;
|
||||
case YELLOW: return yellowFlower;
|
||||
case LIME: return limeFlower;
|
||||
case PINK: return pinkFlower;
|
||||
case GRAY: return grayFlower;
|
||||
case LIGHT_GRAY: return lightGrayFlower;
|
||||
case CYAN: return cyanFlower;
|
||||
case PURPLE: return purpleFlower;
|
||||
case BLUE: return blueFlower;
|
||||
case BROWN: return brownFlower;
|
||||
case GREEN: return greenFlower;
|
||||
case RED: return redFlower;
|
||||
case BLACK: return blackFlower;
|
||||
}
|
||||
}
|
||||
|
||||
public static Block getFlower(EnumDyeColor color) {
|
||||
return getOrderedFlowers()[color.getId()];
|
||||
public static Block getWool(EnumDyeColor color) {
|
||||
switch (color) {
|
||||
default:
|
||||
case WHITE: return Blocks.WHITE_WOOL;
|
||||
case ORANGE: return Blocks.ORANGE_WOOL;
|
||||
case MAGENTA: return Blocks.ORANGE_WOOL;
|
||||
case LIGHT_BLUE: return Blocks.ORANGE_WOOL;
|
||||
case YELLOW: return Blocks.ORANGE_WOOL;
|
||||
case LIME: return Blocks.ORANGE_WOOL;
|
||||
case PINK: return Blocks.ORANGE_WOOL;
|
||||
case GRAY: return Blocks.ORANGE_WOOL;
|
||||
case LIGHT_GRAY: return Blocks.ORANGE_WOOL;
|
||||
case CYAN: return Blocks.ORANGE_WOOL;
|
||||
case PURPLE: return Blocks.ORANGE_WOOL;
|
||||
case BLUE: return Blocks.ORANGE_WOOL;
|
||||
case BROWN: return Blocks.ORANGE_WOOL;
|
||||
case GREEN: return Blocks.ORANGE_WOOL;
|
||||
case RED: return Blocks.ORANGE_WOOL;
|
||||
case BLACK: return Blocks.ORANGE_WOOL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -164,9 +164,9 @@ public class SubTilePureDaisy extends SubTileEntity {
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInt(TAG_POSITION, positionAt);
|
||||
cmp.putInt(TAG_POSITION, positionAt);
|
||||
for(int i = 0; i < ticksRemaining.length; i++)
|
||||
cmp.setInt(TAG_TICKS_REMAINING + i, ticksRemaining[i]);
|
||||
cmp.putInt(TAG_TICKS_REMAINING + i, ticksRemaining[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SubTileBubbell extends SubTileFunctional {
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
cmp.setInt(TAG_RANGE, range);
|
||||
cmp.putInt(TAG_RANGE, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -146,8 +146,8 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
|
||||
cmp.setInt(TAG_ORIENTATION, orientation.getIndex());
|
||||
cmp.setInt(TAG_WIND_TICKS, windTicks);
|
||||
cmp.putInt(TAG_ORIENTATION, orientation.getIndex());
|
||||
cmp.putInt(TAG_WIND_TICKS, windTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,6 @@ package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -207,7 +206,7 @@ public class SubTileHopperhock extends SubTileFunctional {
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
|
||||
cmp.setInt(TAG_FILTER_TYPE, filterType);
|
||||
cmp.putInt(TAG_FILTER_TYPE, filterType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -219,15 +218,15 @@ public class SubTileHopperhock extends SubTileFunctional {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
super.renderHUD(mc, res);
|
||||
public void renderHUD(Minecraft mc) {
|
||||
super.renderHUD(mc);
|
||||
|
||||
int color = getColor();
|
||||
String filter = I18n.format("botaniamisc.filter" + filterType);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(filter) / 2;
|
||||
int y = res.getScaledHeight() / 2 + 30;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(filter) / 2;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 + 30;
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(filter, x, y, color);
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class SubTileJadedAmaranthus extends SubTileFunctional {
|
||||
Block blockAbove = stateAbove.getBlock();
|
||||
if((supertile.getWorld().isAirBlock(up) || blockAbove.isReplaceable(supertile.getWorld(), up)) && stateAbove.getMaterial() != Material.WATER && ModBlocks.flower.canPlaceBlockAt(supertile.getWorld(), up)) {
|
||||
EnumDyeColor color = EnumDyeColor.byId(supertile.getWorld().rand.nextInt(16));
|
||||
IBlockState state = ModBlocks.flower.getDefaultState().with(BotaniaStateProps.COLOR, color);
|
||||
IBlockState state = ModBlocks.getFlower(color).getDefaultState();
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playEvent(2001, up, Block.getStateId(state));
|
||||
supertile.getWorld().setBlockState(up, state, 1 | 2);
|
||||
|
||||
@@ -134,7 +134,7 @@ public class SubTileLoonuim extends SubTileFunctional {
|
||||
entity.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, entity instanceof EntityCreeper ? 100 : Integer.MAX_VALUE, 0));
|
||||
|
||||
NBTTagCompound cmp = stack.write(new NBTTagCompound());
|
||||
entity.getEntityData().setTag(TAG_ITEMSTACK_TO_DROP, cmp);
|
||||
entity.getEntityData().put(TAG_ITEMSTACK_TO_DROP, cmp);
|
||||
|
||||
entity.onInitialSpawn(world.getDifficultyForLocation(pos), null, null);
|
||||
world.spawnEntity(entity);
|
||||
@@ -173,21 +173,21 @@ public class SubTileLoonuim extends SubTileFunctional {
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
super.readFromPacketNBT(cmp);
|
||||
if (cmp.hasKey(TAG_LOOT_TABLE))
|
||||
if (cmp.contains(TAG_LOOT_TABLE))
|
||||
lootTable = new ResourceLocation(cmp.getString(TAG_LOOT_TABLE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
cmp.setString(TAG_LOOT_TABLE, lootTable.toString());
|
||||
cmp.putString(TAG_LOOT_TABLE, lootTable.toString());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public static void onDrops(LivingDropsEvent event) {
|
||||
EntityLivingBase e = event.getEntityLiving();
|
||||
if(e.getEntityData().hasKey(TAG_ITEMSTACK_TO_DROP)) {
|
||||
NBTTagCompound cmp = e.getEntityData().getCompoundTag(TAG_ITEMSTACK_TO_DROP);
|
||||
if(e.getEntityData().contains(TAG_ITEMSTACK_TO_DROP)) {
|
||||
NBTTagCompound cmp = e.getEntityData().getCompound(TAG_ITEMSTACK_TO_DROP);
|
||||
ItemStack stack = ItemStack.read(cmp);
|
||||
event.getDrops().clear();
|
||||
event.getDrops().add(new EntityItem(e.world, e.posX, e.posY, e.posZ, stack));
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStone;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.pattern.BlockStateMatcher;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -35,6 +35,7 @@ import vazkii.botania.common.lexicon.LexiconData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class SubTileOrechid extends SubTileFunctional {
|
||||
|
||||
@@ -44,6 +45,7 @@ public class SubTileOrechid extends SubTileFunctional {
|
||||
private static final int DELAY_GOG = 2;
|
||||
private static final int RANGE = 5;
|
||||
private static final int RANGE_Y = 3;
|
||||
private static final int TRIES = 20;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
@@ -56,13 +58,11 @@ public class SubTileOrechid extends SubTileFunctional {
|
||||
if(mana >= cost && ticksExisted % getDelay() == 0) {
|
||||
BlockPos coords = getCoordsToPut();
|
||||
if(coords != null) {
|
||||
ItemStack stack = getOreToPut();
|
||||
if(!stack.isEmpty()) {
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
int meta = stack.getItemDamage();
|
||||
supertile.getWorld().setBlockState(coords, block.getStateFromMeta(meta), 1 | 2);
|
||||
IBlockState state = getOreToPut();
|
||||
if(state != null) {
|
||||
supertile.getWorld().setBlockState(coords, state);
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playEvent(2001, coords, Block.getIdFromBlock(block) + (meta << 12));
|
||||
supertile.getWorld().playEvent(2001, coords, Block.getStateId(state));
|
||||
supertile.getWorld().playSound(null, supertile.getPos(), ModSounds.orechid, SoundCategory.BLOCKS, 2F, 1F);
|
||||
|
||||
mana -= cost;
|
||||
@@ -72,36 +72,21 @@ public class SubTileOrechid extends SubTileFunctional {
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getOreToPut() {
|
||||
List<WeightedRandom.Item> values = new ArrayList<>();
|
||||
Map<String, Integer> map = getOreMap();
|
||||
for(String s : map.keySet())
|
||||
values.add(new StringRandomItem(map.get(s), s));
|
||||
private IBlockState getOreToPut() {
|
||||
for (int i = 0; i < TRIES; i++) {
|
||||
List<WeightedRandom.Item> values = new ArrayList<>();
|
||||
Map<ResourceLocation, Integer> map = getOreMap();
|
||||
for(ResourceLocation s : map.keySet())
|
||||
values.add(new TagRandomItem(map.get(s), s));
|
||||
|
||||
String ore = ((StringRandomItem) WeightedRandom.getRandomItem(supertile.getWorld().rand, values)).s;
|
||||
|
||||
List<ItemStack> ores = OreDictionary.getOres(ore);
|
||||
|
||||
for(ItemStack stack : ores) {
|
||||
Item item = stack.getItem();
|
||||
String clname = item.getClass().getName();
|
||||
|
||||
// This poem is dedicated to Greg
|
||||
//
|
||||
// Greg.
|
||||
// I get what you do when
|
||||
// others say it's a grind.
|
||||
// But take your TE ores
|
||||
// and stick them in your behind.
|
||||
if(clname.startsWith("gregtech") || clname.startsWith("gregapi"))
|
||||
continue;
|
||||
if(!(item instanceof ItemBlock))
|
||||
continue;
|
||||
|
||||
return stack;
|
||||
ResourceLocation ore = ((TagRandomItem) WeightedRandom.getRandomItem(supertile.getWorld().rand, values)).s;
|
||||
Tag<Block> tag = BlockTags.getCollection().get(ore);
|
||||
if(tag != null && !tag.getAllElements().isEmpty()) {
|
||||
return tag.getRandomElement(getWorld().getRandom()).getDefaultState();
|
||||
}
|
||||
}
|
||||
|
||||
return getOreToPut();
|
||||
return null;
|
||||
}
|
||||
|
||||
private BlockPos getCoordsToPut() {
|
||||
@@ -122,7 +107,7 @@ public class SubTileOrechid extends SubTileFunctional {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getOreMap() {
|
||||
public Map<ResourceLocation, Integer> getOreMap() {
|
||||
return BotaniaAPI.oreWeights;
|
||||
}
|
||||
|
||||
@@ -163,12 +148,12 @@ public class SubTileOrechid extends SubTileFunctional {
|
||||
return LexiconData.orechid;
|
||||
}
|
||||
|
||||
private static class StringRandomItem extends WeightedRandom.Item {
|
||||
private static class TagRandomItem extends WeightedRandom.Item {
|
||||
|
||||
public final String s;
|
||||
public final ResourceLocation s;
|
||||
|
||||
public StringRandomItem(int par1, String s) {
|
||||
super(par1);
|
||||
public TagRandomItem(int weight, ResourceLocation s) {
|
||||
super(weight);
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -10,15 +10,15 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class SubTileOrechidIgnem extends SubTileOrechid {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class SubTileOrechidIgnem extends SubTileOrechid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getOreMap() {
|
||||
public Map<ResourceLocation, Integer> getOreMap() {
|
||||
return BotaniaAPI.oreWeightsNether;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
|
||||
+9
-8
@@ -28,6 +28,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -160,22 +161,22 @@ public class SubTileRannuncarpus extends SubTileFunctional {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
super.renderHUD(mc, res);
|
||||
public void renderHUD(Minecraft mc) {
|
||||
super.renderHUD(mc);
|
||||
|
||||
IBlockState filter = getUnderlyingBlock();
|
||||
ItemStack recieverStack = new ItemStack(Item.getItemFromBlock(filter.getBlock()), 1, filter.getBlock().getMetaFromState(filter));
|
||||
ItemStack recieverStack = new ItemStack(filter.getBlock());
|
||||
int color = getColor();
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
if(!recieverStack.isEmpty()) {
|
||||
String stackName = recieverStack.getDisplayName();
|
||||
int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
|
||||
int x = res.getScaledWidth() / 2 - width;
|
||||
int y = res.getScaledHeight() / 2 + 30;
|
||||
ITextComponent stackName = recieverStack.getDisplayName();
|
||||
int width = 16 + mc.fontRenderer.getStringWidth(stackName.getString()) / 2;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - width;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 + 30;
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color);
|
||||
mc.fontRenderer.drawStringWithShadow(stackName.getFormattedText(), x + 20, y + 5, color);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(recieverStack, x, y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
+4
-4
@@ -74,7 +74,7 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
if(mana >= cost) {
|
||||
spawnExplosionParticles(item, 10);
|
||||
item.setPosition(bindPos.getX() + 0.5, bindPos.getY() + 1.5, bindPos.getZ() + 0.5);
|
||||
item.getEntityData().setBoolean(TAG_TELEPORTED, true);
|
||||
item.getEntityData().putBoolean(TAG_TELEPORTED, true);
|
||||
item.motionX = item.motionY = item.motionZ = 0;
|
||||
spawnExplosionParticles(item, 10);
|
||||
mana -= cost;
|
||||
@@ -100,9 +100,9 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
cmp.setInt(TAG_BIND_X, bindPos.getX());
|
||||
cmp.setInt(TAG_BIND_Y, bindPos.getY());
|
||||
cmp.setInt(TAG_BIND_Z, bindPos.getZ());
|
||||
cmp.putInt(TAG_BIND_X, bindPos.getX());
|
||||
cmp.putInt(TAG_BIND_Y, bindPos.getY());
|
||||
cmp.putInt(TAG_BIND_Z, bindPos.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
|
||||
+5
-5
@@ -52,7 +52,7 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
runSimulation();
|
||||
}
|
||||
|
||||
void runSimulation() {
|
||||
private void runSimulation() {
|
||||
int[][] table = getCellTable();
|
||||
List<int[]> changes = new ArrayList<>();
|
||||
new ArrayList();
|
||||
@@ -102,7 +102,7 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
}
|
||||
}
|
||||
|
||||
int[][] getCellTable() {
|
||||
private int[][] getCellTable() {
|
||||
int diam = RANGE * 2 + 1;
|
||||
int[][] table = new int[diam][diam];
|
||||
|
||||
@@ -117,7 +117,7 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
return table;
|
||||
}
|
||||
|
||||
int getCellGeneration(BlockPos pos) {
|
||||
private int getCellGeneration(BlockPos pos) {
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(pos);
|
||||
if(tile instanceof TileCell)
|
||||
return ((TileCell) tile).isSameFlower(supertile) ? ((TileCell) tile).getGeneration() : 0;
|
||||
@@ -125,7 +125,7 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int getAdjCells(int[][] table, int x, int z) {
|
||||
private int getAdjCells(int[][] table, int x, int z) {
|
||||
int count = 0;
|
||||
for(int[] shift : ADJACENT_BLOCKS) {
|
||||
int xp = x + shift[0];
|
||||
@@ -140,7 +140,7 @@ public class SubTileDandelifeon extends SubTileGenerating {
|
||||
return count;
|
||||
}
|
||||
|
||||
int getSpawnCellGeneration(int[][] table, int x, int z) {
|
||||
private int getSpawnCellGeneration(int[][] table, int x, int z) {
|
||||
int max = -1;
|
||||
for(int[] shift : ADJACENT_BLOCKS) {
|
||||
int xp = x + shift[0];
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SubTileEndoflame extends SubTileGenerating {
|
||||
if(getWorld().isRemote) {
|
||||
if(burnTime > 0 && supertile.getWorld().rand.nextInt(10) == 0) {
|
||||
Vec3d offset = getWorld().getBlockState(getPos()).getOffset(getWorld(), getPos()).add(0.4, 0.7, 0.4);
|
||||
supertile.getWorld().spawnParticle(Particles.FLAME, supertile.getPos().getX() + offset.x + Math.random() * 0.2, supertile.getPos().getY() + offset.y, supertile.getPos().getZ() + offset.z + Math.random() * 0.2, 0.0D, 0.0D, 0.0D);
|
||||
supertile.getWorld().addParticle(Particles.FLAME, supertile.getPos().getX() + offset.x + Math.random() * 0.2, supertile.getPos().getY() + offset.y, supertile.getPos().getZ() + offset.z + Math.random() * 0.2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -86,8 +86,8 @@ public class SubTileEndoflame extends SubTileGenerating {
|
||||
if(event == START_BURN_EVENT) {
|
||||
Entity e = getWorld().getEntityByID(param);
|
||||
if(e != null) {
|
||||
e.world.spawnParticle(Particles.LARGE_SMOKE, e.posX, e.posY + 0.1, e.posZ, 0.0D, 0.0D, 0.0D);
|
||||
e.world.spawnParticle(Particles.FLAME, e.posX, e.posY, e.posZ, 0.0D, 0.0D, 0.0D);
|
||||
e.world.addParticle(Particles.LARGE_SMOKE, e.posX, e.posY + 0.1, e.posZ, 0.0D, 0.0D, 0.0D);
|
||||
e.world.addParticle(Particles.FLAME, e.posX, e.posY, e.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@@ -124,7 +124,7 @@ public class SubTileEndoflame extends SubTileGenerating {
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
|
||||
cmp.setInt(TAG_BURN_TIME, burnTime);
|
||||
cmp.putInt(TAG_BURN_TIME, burnTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class SubTileEntropinnyum extends SubTileGenerating {
|
||||
for(int i = 0; i < 50; i++)
|
||||
Botania.proxy.sparkleFX(e.posX + Math.random() * 4 - 2, e.posY + Math.random() * 4 - 2, e.posZ + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12);
|
||||
|
||||
getWorld().spawnParticle(Particles.EXPLOSION_EMITTER, e.posX, e.posY, e.posZ, 1D, 0D, 0D);
|
||||
getWorld().addParticle(Particles.EXPLOSION_EMITTER, e.posX, e.posY, e.posZ, 1D, 0D, 0D);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
||||
+5
-6
@@ -18,7 +18,6 @@ import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.particles.ItemParticleData;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -95,7 +94,7 @@ public class SubTileGourmaryllis extends SubTileGenerating {
|
||||
cooldown = val * 10;
|
||||
item.playSound(SoundEvents.ENTITY_GENERIC_EAT, 0.2F, 0.6F);
|
||||
sync();
|
||||
((WorldServer) supertile.getWorld()).spawnParticle(new ItemParticleData(Particles.ITEM, stack), false, item.posX, item.posY, item.posZ, 20, 0.1D, 0.1D, 0.1D, 0.05D);
|
||||
((WorldServer) supertile.getWorld()).spawnParticle(new ItemParticleData(Particles.ITEM, stack), item.posX, item.posY, item.posZ, 20, 0.1D, 0.1D, 0.1D, 0.05D);
|
||||
}
|
||||
|
||||
item.remove();
|
||||
@@ -106,10 +105,10 @@ public class SubTileGourmaryllis extends SubTileGenerating {
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
cmp.setInt(TAG_COOLDOWN, cooldown);
|
||||
cmp.setInt(TAG_DIGESTING_MANA, digestingMana);
|
||||
cmp.setTag(TAG_LAST_FOOD, lastFood.write(new NBTTagCompound()));
|
||||
cmp.setInt(TAG_LAST_FOOD_COUNT, lastFoodCount);
|
||||
cmp.putInt(TAG_COOLDOWN, cooldown);
|
||||
cmp.putInt(TAG_DIGESTING_MANA, digestingMana);
|
||||
cmp.put(TAG_LAST_FOOD, lastFood.write(new NBTTagCompound()));
|
||||
cmp.putInt(TAG_LAST_FOOD_COUNT, lastFoodCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+24
-19
@@ -11,19 +11,21 @@
|
||||
package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
@@ -62,19 +64,22 @@ public class SubTileHydroangeas extends SubTileGenerating {
|
||||
for(BlockPos offset : offsets) {
|
||||
BlockPos pos = supertile.getPos().add(offset);
|
||||
|
||||
Material search = getMaterialToSearchFor();
|
||||
PropertyInteger prop = supertile.getWorld().getBlockState(pos).getBlock() instanceof BlockLiquid ? BlockLiquid.LEVEL : supertile.getWorld().getBlockState(pos).getBlock() instanceof BlockFluidBase ? BlockFluidBase.LEVEL : null;
|
||||
if(supertile.getWorld().getBlockState(pos).getMaterial() == search && (getBlockToSearchBelow() == null || supertile.getWorld().getBlockState(pos.down()).getBlock() == getBlockToSearchBelow()) && (prop == null || supertile.getWorld().getBlockState(pos).getValue(prop) == 0)) {
|
||||
if(search != Material.WATER)
|
||||
supertile.getWorld().setBlockToAir(pos);
|
||||
IFluidState fstate = supertile.getWorld().getFluidState(pos);
|
||||
Tag<Fluid> search = getMaterialToSearchFor();
|
||||
if(fstate.isTagged(search)
|
||||
&& (getBlockToSearchBelow() == null
|
||||
|| supertile.getWorld().getBlockState(pos.down()).getBlock() == getBlockToSearchBelow())
|
||||
&& fstate.isSource()) {
|
||||
if(search != FluidTags.WATER)
|
||||
supertile.getWorld().setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
else {
|
||||
int waterAround = 0;
|
||||
for(EnumFacing dir : EnumFacing.HORIZONTALS)
|
||||
if(supertile.getWorld().getBlockState(pos.offset(dir)).getMaterial() == search)
|
||||
for(EnumFacing dir : EnumFacing.BY_INDEX)
|
||||
if(supertile.getWorld().getFluidState(pos.offset(dir)).isTagged(search))
|
||||
waterAround++;
|
||||
|
||||
if(waterAround < 2)
|
||||
supertile.getWorld().setBlockToAir(pos);
|
||||
supertile.getWorld().setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
}
|
||||
|
||||
if(cooldown == 0)
|
||||
@@ -102,8 +107,8 @@ public class SubTileHydroangeas extends SubTileGenerating {
|
||||
Botania.proxy.wispFX(supertile.getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, supertile.getPos().getY() + 0.55 + Math.random() * 0.2 - 0.1, supertile.getPos().getZ() + 0.5, 0.05F, 0.05F, 0.7F, (float) Math.random() / 6, (float) -Math.random() / 60);
|
||||
}
|
||||
|
||||
public Material getMaterialToSearchFor() {
|
||||
return Material.WATER;
|
||||
public Tag<Fluid> getMaterialToSearchFor() {
|
||||
return FluidTags.WATER;
|
||||
}
|
||||
|
||||
public Block getBlockToSearchBelow() {
|
||||
@@ -142,16 +147,16 @@ public class SubTileHydroangeas extends SubTileGenerating {
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
|
||||
cmp.setInteger(TAG_BURN_TIME, burnTime);
|
||||
cmp.setInteger(TAG_COOLDOWN, cooldown);
|
||||
cmp.putInt(TAG_BURN_TIME, burnTime);
|
||||
cmp.putInt(TAG_COOLDOWN, cooldown);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
super.readFromPacketNBT(cmp);
|
||||
|
||||
burnTime = cmp.getInteger(TAG_BURN_TIME);
|
||||
cooldown = cmp.getInteger(TAG_COOLDOWN);
|
||||
burnTime = cmp.getInt(TAG_BURN_TIME);
|
||||
cooldown = cmp.getInt(TAG_COOLDOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,7 +183,7 @@ public class SubTileHydroangeas extends SubTileGenerating {
|
||||
|
||||
@Override
|
||||
public int getDelayBetweenPassiveGeneration() {
|
||||
boolean rain = supertile.getWorld().getBiome(supertile.getPos()).getRainfall() > 0 && (supertile.getWorld().isRaining() || supertile.getWorld().isThundering());
|
||||
boolean rain = supertile.getWorld().getBiome(supertile.getPos()).getPrecipitation() == Biome.RainType.RAIN && (supertile.getWorld().isRaining() || supertile.getWorld().isThundering());
|
||||
return rain ? 2 : 3;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ public class SubTileMunchdew extends SubTileGenerating {
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
|
||||
cmp.setInt(TAG_COOLDOWN, cooldown);
|
||||
cmp.setBoolean(TAG_ATE_ONCE, ateOnce);
|
||||
cmp.putInt(TAG_COOLDOWN, cooldown);
|
||||
cmp.putBoolean(TAG_ATE_ONCE, ateOnce);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SubTileNarslimmus extends SubTileGenerating {
|
||||
float f2 = MathHelper.sin(f) * size * 0.5F * f1;
|
||||
float f3 = MathHelper.cos(f) * size * 0.5F * f1;
|
||||
float f4 = slime.world.rand.nextFloat() * size * 0.5F * f1;
|
||||
slime.world.spawnParticle(Particles.ITEM_SLIME, slime.posX + f2, slime.getBoundingBox().minY + f4, slime.posZ + f3, 0.0D, 0.0D, 0.0D);
|
||||
slime.world.addParticle(Particles.ITEM_SLIME, slime.posX + f2, slime.getBoundingBox().minY + f4, slime.posZ + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -93,8 +93,14 @@ public class SubTileNarslimmus extends SubTileGenerating {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onSpawn(LivingSpawnEvent.CheckSpawn event) {
|
||||
if(event.getEntityLiving() instanceof EntitySlime && event.getResult() != Event.Result.DENY && isSlimeChunk(event.getEntityLiving().world, MathHelper.floor(event.getX()), MathHelper.floor(event.getZ())))
|
||||
event.getEntityLiving().getEntityData().setBoolean(TAG_WORLD_SPAWNED, true);
|
||||
if(event.getEntityLiving() instanceof EntitySlime
|
||||
&& event.getResult() != Event.Result.DENY
|
||||
&& isSlimeChunk(event.getEntityLiving().world, event.getX(), event.getZ()))
|
||||
event.getEntityLiving().getEntityData().putBoolean(TAG_WORLD_SPAWNED, true);
|
||||
}
|
||||
|
||||
private static boolean isSlimeChunk(World world, double x, double z) {
|
||||
return isSlimeChunk(world, new BlockPos(x, 0, z));
|
||||
}
|
||||
|
||||
public static boolean isSlimeChunk(World world, BlockPos pos) {
|
||||
|
||||
@@ -33,8 +33,8 @@ public class SubTileRafflowsia extends SubTileGenerating {
|
||||
private static final String TAG_LAST_FLOWER = "lastFlower";
|
||||
private static final String TAG_LAST_FLOWER_TIMES = "lastFlowerTimes";
|
||||
|
||||
String lastFlower;
|
||||
int lastFlowerTimes;
|
||||
private String lastFlower;
|
||||
private int lastFlowerTimes;
|
||||
|
||||
private static final int RANGE = 5;
|
||||
|
||||
@@ -80,8 +80,8 @@ public class SubTileRafflowsia extends SubTileGenerating {
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
|
||||
cmp.setString(TAG_LAST_FLOWER, lastFlower);
|
||||
cmp.setInt(TAG_LAST_FLOWER_TIMES, lastFlowerTimes);
|
||||
cmp.putString(TAG_LAST_FLOWER, lastFlower);
|
||||
cmp.putInt(TAG_LAST_FLOWER_TIMES, lastFlowerTimes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,6 @@ import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.init.Particles;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
+21
-21
@@ -10,19 +10,20 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Particles;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.particles.ItemParticleData;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -30,6 +31,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
|
||||
import java.awt.Color;
|
||||
@@ -41,7 +43,7 @@ public class SubTileSpectrolus extends SubTileGenerating {
|
||||
|
||||
private static final int RANGE = 1;
|
||||
|
||||
int nextColor;
|
||||
private EnumDyeColor nextColor = EnumDyeColor.WHITE;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
@@ -50,22 +52,21 @@ public class SubTileSpectrolus extends SubTileGenerating {
|
||||
if (supertile.getWorld().isRemote)
|
||||
return;
|
||||
|
||||
Item wool = Item.getItemFromBlock(Blocks.WOOL);
|
||||
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
int slowdown = getSlowdownFactor();
|
||||
|
||||
for(EntityItem item : items) {
|
||||
ItemStack stack = item.getItem();
|
||||
|
||||
if(!stack.isEmpty() && stack.getItem() == wool && !item.isDead && item.age >= slowdown) {
|
||||
int meta = stack.getItemDamage();
|
||||
if(meta == nextColor) {
|
||||
if(!stack.isEmpty() && item.isAlive() && item.age >= slowdown) {
|
||||
Block expected = ModBlocks.getWool(nextColor);
|
||||
|
||||
if(expected.asItem() == stack.getItem()) {
|
||||
mana = Math.min(getMaxMana(), mana + 2400);
|
||||
nextColor = nextColor == 15 ? 0 : nextColor + 1;
|
||||
nextColor = nextColor == EnumDyeColor.BLACK ? EnumDyeColor.WHITE : EnumDyeColor.values()[nextColor.ordinal() + 1];
|
||||
sync();
|
||||
|
||||
((WorldServer) supertile.getWorld()).spawnParticle(new ItemParticleData(Particles.ITEM, stack), false, item.posX, item.posY, item.posZ, 20, 0.1D, 0.1D, 0.1D, 0.05D);
|
||||
((WorldServer) supertile.getWorld()).spawnParticle(new ItemParticleData(Particles.ITEM, stack), item.posX, item.posY, item.posZ, 20, 0.1D, 0.1D, 0.1D, 0.05D);
|
||||
}
|
||||
|
||||
item.remove();
|
||||
@@ -95,21 +96,21 @@ public class SubTileSpectrolus extends SubTileGenerating {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
super.renderHUD(mc, res);
|
||||
public void renderHUD(Minecraft mc) {
|
||||
super.renderHUD(mc);
|
||||
|
||||
ItemStack stack = new ItemStack(Blocks.WOOL, 1, nextColor);
|
||||
ItemStack stack = new ItemStack(ModBlocks.getWool(nextColor));
|
||||
int color = getColor();
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
if(!stack.isEmpty()) {
|
||||
String stackName = stack.getDisplayName();
|
||||
int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
|
||||
int x = res.getScaledWidth() / 2 - width;
|
||||
int y = res.getScaledHeight() / 2 + 30;
|
||||
ITextComponent stackName = stack.getDisplayName();
|
||||
int width = 16 + mc.fontRenderer.getStringWidth(stackName.getString()) / 2;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - width;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 + 30;
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color);
|
||||
mc.fontRenderer.drawStringWithShadow(stackName.getFormattedText(), x + 20, y + 5, color);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, x, y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
@@ -122,13 +123,12 @@ public class SubTileSpectrolus extends SubTileGenerating {
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
cmp.setInt(TAG_NEXT_COLOR, nextColor);
|
||||
cmp.putInt(TAG_NEXT_COLOR, nextColor.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
super.readFromPacketNBT(cmp);
|
||||
nextColor = cmp.getInt(TAG_NEXT_COLOR);
|
||||
nextColor = EnumDyeColor.byId(cmp.getInt(TAG_NEXT_COLOR));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,9 @@
|
||||
package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -35,8 +38,8 @@ public class SubTileThermalily extends SubTileHydroangeas {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterialToSearchFor() {
|
||||
return Material.LAVA;
|
||||
public Tag<Fluid> getMaterialToSearchFor() {
|
||||
return FluidTags.LAVA;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ITickable;
|
||||
@@ -32,7 +33,6 @@ import vazkii.botania.api.recipe.IElvenItem;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.AlfPortalState;
|
||||
import vazkii.botania.api.state.enums.LivingWoodVariant;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.mana.BlockPool;
|
||||
@@ -91,7 +91,7 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
for(BlockPos l : LIVINGWOOD_POSITIONS)
|
||||
mb.addComponent(l.up(), ModBlocks.livingwood.getDefaultState());
|
||||
for(BlockPos g : GLIMMERING_LIVINGWOOD_POSITIONS)
|
||||
mb.addComponent(g.up(), ModBlocks.livingwood.getDefaultState().with(BotaniaStateProps.LIVINGWOOD_VARIANT, LivingWoodVariant.GLIMMERING));
|
||||
mb.addComponent(g.up(), ModBlocks.livingwoodGlimmering.getDefaultState());
|
||||
// for(BlockPos p : PYLON_POSITIONS)
|
||||
// mb.addComponent(new BlockPos(-p.getX(), p.getY() + 1, -p.getZ()), ModBlocks.pylon.getDefaultState().with(BotaniaStateProps.PYLON_VARIANT, PylonVariant.NATURA));
|
||||
// for(BlockPos p : POOL_POSITIONS)
|
||||
@@ -128,12 +128,12 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, aabb);
|
||||
if(!world.isRemote)
|
||||
for(EntityItem item : items) {
|
||||
if(item.isDead)
|
||||
if(!item.isAlive())
|
||||
continue;
|
||||
|
||||
ItemStack stack = item.getItem();
|
||||
boolean consume;
|
||||
if (item.getEntityData().hasKey(TAG_PORTAL_FLAG)) {
|
||||
if (item.getEntityData().contains(TAG_PORTAL_FLAG)) {
|
||||
consume = false;
|
||||
} else if (stack.getItem() instanceof ItemLexicon) {
|
||||
consume = true;
|
||||
@@ -144,7 +144,7 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
}
|
||||
|
||||
if (consume) {
|
||||
item.setDead();
|
||||
item.remove();
|
||||
if (validateItemUsage(stack))
|
||||
addItem(stack);
|
||||
ticksSinceLastItem = 0;
|
||||
@@ -178,16 +178,9 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
return true;
|
||||
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
for(Object o : recipe.getInputs()) {
|
||||
if(o instanceof String) {
|
||||
for(ItemStack target : OreDictionary.getOres((String) o)) {
|
||||
if(OreDictionary.itemMatches(target, inputStack, false))
|
||||
return true;
|
||||
}
|
||||
} else if(o instanceof ItemStack) {
|
||||
ItemStack target = (ItemStack) o;
|
||||
if(inputStack.getItem() == target.getItem() && inputStack.getItemDamage() == target.getItemDamage())
|
||||
return true;
|
||||
for(Ingredient o : recipe.getInputs()) {
|
||||
if(o.test(inputStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,7 +203,7 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
}
|
||||
|
||||
public boolean onWanded() {
|
||||
AlfPortalState state = world.getBlockState(getPos()).getValue(BotaniaStateProps.ALFPORTAL_STATE);
|
||||
AlfPortalState state = world.getBlockState(getPos()).get(BotaniaStateProps.ALFPORTAL_STATE);
|
||||
if(state == AlfPortalState.OFF) {
|
||||
AlfPortalState newState = getValidState();
|
||||
if(newState != AlfPortalState.OFF) {
|
||||
@@ -224,7 +217,7 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
|
||||
private AxisAlignedBB getPortalAABB() {
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(pos.add(-1, 1, 0), pos.add(2, 4, 1));
|
||||
if(world.getBlockState(getPos()).getValue(BotaniaStateProps.ALFPORTAL_STATE) == AlfPortalState.ON_X)
|
||||
if(world.getBlockState(getPos()).get(BotaniaStateProps.ALFPORTAL_STATE) == AlfPortalState.ON_X)
|
||||
aabb = new AxisAlignedBB(pos.add(0, 1, -1), pos.add(1, 4, 2));
|
||||
|
||||
return aabb;
|
||||
@@ -267,21 +260,21 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
|
||||
private void spawnItem(ItemStack stack) {
|
||||
EntityItem item = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, stack);
|
||||
item.getEntityData().setBoolean(TAG_PORTAL_FLAG, true);
|
||||
item.getEntityData().putBoolean(TAG_PORTAL_FLAG, true);
|
||||
world.spawnEntity(item);
|
||||
ticksSinceLastItem = 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound cmp) {
|
||||
NBTTagCompound ret = super.writeToNBT(cmp);
|
||||
public NBTTagCompound write(NBTTagCompound cmp) {
|
||||
NBTTagCompound ret = super.write(cmp);
|
||||
|
||||
cmp.setInteger(TAG_STACK_COUNT, stacksIn.size());
|
||||
cmp.putInt(TAG_STACK_COUNT, stacksIn.size());
|
||||
int i = 0;
|
||||
for(ItemStack stack : stacksIn) {
|
||||
NBTTagCompound stackcmp = stack.writeToNBT(new NBTTagCompound());
|
||||
cmp.setTag(TAG_STACK + i, stackcmp);
|
||||
NBTTagCompound stackcmp = stack.write(new NBTTagCompound());
|
||||
cmp.put(TAG_STACK + i, stackcmp);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -289,28 +282,28 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound cmp) {
|
||||
super.readFromNBT(cmp);
|
||||
public void read(NBTTagCompound cmp) {
|
||||
super.read(cmp);
|
||||
|
||||
int count = cmp.getInteger(TAG_STACK_COUNT);
|
||||
int count = cmp.getInt(TAG_STACK_COUNT);
|
||||
stacksIn.clear();
|
||||
for(int i = 0; i < count; i++) {
|
||||
NBTTagCompound stackcmp = cmp.getCompoundTag(TAG_STACK + i);
|
||||
ItemStack stack = new ItemStack(stackcmp);
|
||||
NBTTagCompound stackcmp = cmp.getCompound(TAG_STACK + i);
|
||||
ItemStack stack = ItemStack.read(stackcmp);
|
||||
stacksIn.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_TICKS_OPEN, ticksOpen);
|
||||
cmp.setInteger(TAG_TICKS_SINCE_LAST_ITEM, ticksSinceLastItem);
|
||||
cmp.putInt(TAG_TICKS_OPEN, ticksOpen);
|
||||
cmp.putInt(TAG_TICKS_SINCE_LAST_ITEM, ticksSinceLastItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPacketNBT(NBTTagCompound cmp) {
|
||||
ticksOpen = cmp.getInteger(TAG_TICKS_OPEN);
|
||||
ticksSinceLastItem = cmp.getInteger(TAG_TICKS_SINCE_LAST_ITEM);
|
||||
ticksOpen = cmp.getInt(TAG_TICKS_OPEN);
|
||||
ticksSinceLastItem = cmp.getInt(TAG_TICKS_SINCE_LAST_ITEM);
|
||||
}
|
||||
|
||||
private AlfPortalState getValidState() {
|
||||
@@ -331,9 +324,9 @@ public class TileAlfPortal extends TileMod implements ITickable {
|
||||
private final boolean checkMultipleConverters(Function<BlockPos, BlockPos>... converters) {
|
||||
if(!check2DArray(AIR_POSITIONS, Blocks.AIR.getDefaultState(), true, converters))
|
||||
return false;
|
||||
if(!check2DArray(LIVINGWOOD_POSITIONS, ModBlocks.livingwood.getDefaultState().with(BotaniaStateProps.LIVINGWOOD_VARIANT, LivingWoodVariant.DEFAULT), false, converters))
|
||||
if(!check2DArray(LIVINGWOOD_POSITIONS, ModBlocks.livingwood.getDefaultState(), false, converters))
|
||||
return false;
|
||||
if(!check2DArray(GLIMMERING_LIVINGWOOD_POSITIONS, ModBlocks.livingwood.getDefaultState().with(BotaniaStateProps.LIVINGWOOD_VARIANT, LivingWoodVariant.GLIMMERING), false, converters))
|
||||
if(!check2DArray(GLIMMERING_LIVINGWOOD_POSITIONS, ModBlocks.livingwoodGlimmering.getDefaultState(), false, converters))
|
||||
return false;
|
||||
// if(!check2DArray(PYLON_POSITIONS, ModBlocks.pylon.getDefaultState().with(BotaniaStateProps.PYLON_VARIANT, PylonVariant.NATURA), false, converters))
|
||||
// return false;
|
||||
|
||||
@@ -54,15 +54,15 @@ public class TileCell extends TileMod {
|
||||
|
||||
@Override
|
||||
public void writePacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInt(TAG_GENERATION, generation);
|
||||
cmp.setBoolean(TAG_TICKED, ticked);
|
||||
cmp.putInt(TAG_GENERATION, generation);
|
||||
cmp.putBoolean(TAG_TICKED, ticked);
|
||||
if(ticked) {
|
||||
cmp.setInt(TAG_FLOWER_X, flowerCoords.getX());
|
||||
cmp.setInt(TAG_FLOWER_Y, flowerCoords.getY());
|
||||
cmp.setInt(TAG_FLOWER_Z, flowerCoords.getZ());
|
||||
cmp.setInt(TAG_VALID_X, validCoords.getX());
|
||||
cmp.setInt(TAG_VALID_Y, validCoords.getY());
|
||||
cmp.setInt(TAG_VALID_Z, validCoords.getZ());
|
||||
cmp.putInt(TAG_FLOWER_X, flowerCoords.getX());
|
||||
cmp.putInt(TAG_FLOWER_Y, flowerCoords.getY());
|
||||
cmp.putInt(TAG_FLOWER_Z, flowerCoords.getZ());
|
||||
cmp.putInt(TAG_VALID_X, validCoords.getX());
|
||||
cmp.putInt(TAG_VALID_Y, validCoords.getY());
|
||||
cmp.putInt(TAG_VALID_Z, validCoords.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,13 +191,13 @@ public class InternalMethodHandler extends DummyMethodHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
|
||||
HUDHandler.drawSimpleManaHUD(color, mana, maxMana, name, res);
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name) {
|
||||
HUDHandler.drawSimpleManaHUD(color, mana, maxMana, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {
|
||||
HUDHandler.drawComplexManaHUD(color, mana, maxMana, name, res, bindDisplay, properlyBound);
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {
|
||||
HUDHandler.drawComplexManaHUD(color, mana, maxMana, name, bindDisplay, properlyBound);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,18 +21,21 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
@@ -56,20 +59,23 @@ public class ItemBlockSpecialFlower extends ItemBlockMod implements IRecipeKeyPr
|
||||
|
||||
public ItemBlockSpecialFlower(Block block1) {
|
||||
super(block1);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, World world, @Nonnull BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull IBlockState newState) {
|
||||
boolean placed = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
|
||||
public boolean placeBlock(BlockItemUseContext ctx, @Nonnull IBlockState newState) {
|
||||
boolean placed = super.placeBlock(ctx, newState);
|
||||
if(placed) {
|
||||
ResourceLocation type = getType(stack);
|
||||
World world = ctx.getWorld();
|
||||
BlockPos pos = ctx.getPos();
|
||||
ItemStack stack = ctx.getItem();
|
||||
|
||||
ResourceLocation type = getType(ctx.getItem());
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if(te instanceof TileSpecialFlower) {
|
||||
TileSpecialFlower tile = (TileSpecialFlower) te;
|
||||
tile.setSubTile(type);
|
||||
tile.onBlockAdded(world, pos, newState);
|
||||
tile.onBlockPlacedBy(world, pos, newState, player, stack);
|
||||
tile.onBlockPlacedBy(world, pos, newState, ctx.getPlayer(), stack);
|
||||
if(!world.isRemote)
|
||||
world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 8);
|
||||
}
|
||||
@@ -84,15 +90,9 @@ public class ItemBlockSpecialFlower extends ItemBlockMod implements IRecipeKeyPr
|
||||
return BotaniaAPI.getSignatureForName(getType(stack)).getUnlocalizedNameForStack(stack);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUnlocalizedNameInefficiently(@Nonnull ItemStack par1ItemStack) {
|
||||
return getUnlocalizedNameInefficiently_(par1ItemStack);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public void addInformation(@Nonnull ItemStack par1ItemStack, World world, @Nonnull List<String> stacks, @Nonnull ITooltipFlag flag) {
|
||||
public void addInformation(@Nonnull ItemStack par1ItemStack, World world, @Nonnull List<ITextComponent> stacks, @Nonnull ITooltipFlag flag) {
|
||||
ResourceLocation type = getType(par1ItemStack);
|
||||
SubTileSignature sig = BotaniaAPI.getSignatureForName(type);
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ItemBlockSpecialFlower extends ItemBlockMod implements IRecipeKeyPr
|
||||
String refUnlocalized = sig.getUnlocalizedLoreTextForStack(par1ItemStack);
|
||||
String refLocalized = I18n.format(refUnlocalized);
|
||||
if(!refLocalized.equals(refUnlocalized))
|
||||
stacks.add(TextFormatting.ITALIC + refLocalized);
|
||||
stacks.add(new TextComponentTranslation(refLocalized).applyTextStyle(TextFormatting.ITALIC));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class ItemBlockSpecialFlower extends ItemBlockMod implements IRecipeKeyPr
|
||||
}
|
||||
|
||||
public static ResourceLocation getType(ItemStack stack) {
|
||||
return stack.hasTagCompound() ? new ResourceLocation(ItemNBTHelper.getString(stack, SubTileEntity.TAG_TYPE, BotaniaAPI.DUMMY_SUBTILE_NAME.toString())) : BotaniaAPI.DUMMY_SUBTILE_NAME;
|
||||
return stack.hasTag() ? new ResourceLocation(ItemNBTHelper.getString(stack, SubTileEntity.TAG_TYPE, BotaniaAPI.DUMMY_SUBTILE_NAME.toString())) : BotaniaAPI.DUMMY_SUBTILE_NAME;
|
||||
}
|
||||
|
||||
public static ItemStack ofType(ResourceLocation type) {
|
||||
|
||||
Reference in new issue
Block a user