mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 19:05:16 +00:00
Merge 1.14
This commit is contained in:
commit
f91dd3873f
110 files changed
+1981
-1939
No files matched your search
@@ -126,7 +126,7 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
|
||||
if(cap == BotaniaAPI.FLOATING_FLOWER_CAP) {
|
||||
if(hasWorld() && getWorld().getBlockState(getPos()).isIn(ModTags.Blocks.SPECIAL_FLOATING_FLOWERS)) {
|
||||
if(hasWorld() && getBlockState().isIn(ModTags.Blocks.SPECIAL_FLOATING_FLOWERS)) {
|
||||
return floatingDataCap.cast();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,18 +49,22 @@ public final class ColorHandler {
|
||||
// Pool
|
||||
blocks.register(
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if (((BlockPool) state.getBlock()).variant == BlockPool.Variant.FABULOUS) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return MathHelper.hsvToRGB(time * 0.005F, 0.6F, 1F);
|
||||
} else {
|
||||
if(world != null && pos != null) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if(te instanceof TilePool) {
|
||||
return ((TilePool) te).color.colorValue;
|
||||
}
|
||||
if(tintIndex != 0)
|
||||
return -1;
|
||||
|
||||
int color = DyeColor.WHITE.colorValue;
|
||||
if(world != null && pos != null) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if(te instanceof TilePool) {
|
||||
color = ((TilePool) te).color.colorValue;
|
||||
}
|
||||
return DyeColor.WHITE.colorValue;
|
||||
}
|
||||
if (((BlockPool) state.getBlock()).variant == BlockPool.Variant.FABULOUS){
|
||||
float time = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.005F;
|
||||
int fabulousColor = MathHelper.hsvToRGB(time - (int) time, 0.6F, 1F);
|
||||
return vazkii.botania.common.core.helper.MathHelper.multiplyColor(fabulousColor, color);
|
||||
}
|
||||
return color;
|
||||
},
|
||||
ModBlocks.manaPool, ModBlocks.creativePool, ModBlocks.dilutedPool, ModBlocks.fabulousPool
|
||||
);
|
||||
@@ -75,7 +79,7 @@ public final class ColorHandler {
|
||||
);
|
||||
|
||||
// Petal Block
|
||||
blocks.register((state, world, pos, tintIndex) -> ((BlockPetalBlock) state.getBlock()).color.colorValue,
|
||||
blocks.register((state, world, pos, tintIndex) -> tintIndex == 0 ? ((BlockPetalBlock) state.getBlock()).color.colorValue : -1,
|
||||
ModBlocks.petalBlockWhite, ModBlocks.petalBlockOrange, ModBlocks.petalBlockMagenta, ModBlocks.petalBlockLightBlue,
|
||||
ModBlocks.petalBlockYellow, ModBlocks.petalBlockLime, ModBlocks.petalBlockPink, ModBlocks.petalBlockGray,
|
||||
ModBlocks.petalBlockSilver, ModBlocks.petalBlockCyan, ModBlocks.petalBlockPurple, ModBlocks.petalBlockBlue,
|
||||
@@ -101,7 +105,7 @@ public final class ColorHandler {
|
||||
|
||||
ItemColors items = Minecraft.getInstance().getItemColors();
|
||||
|
||||
items.register((s, t) -> MathHelper.hsvToRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 0.25F, 1F),
|
||||
items.register((s, t) -> t == 0 ? MathHelper.hsvToRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 0.25F, 1F) : -1,
|
||||
ModItems.lifeEssence, ModItems.gaiaIngot);
|
||||
|
||||
items.register((s, t) ->
|
||||
@@ -110,14 +114,14 @@ public final class ColorHandler {
|
||||
: -1,
|
||||
ModItems.twigWand);
|
||||
|
||||
IItemColor petalHandler = (s, t) -> ((ItemPetal) s.getItem()).color.colorValue;
|
||||
IItemColor dyeHandler = (s, t) -> ((Item16Colors) s.getItem()).color.colorValue;
|
||||
IItemColor petalHandler = (s, t) -> t == 0 ? ((ItemPetal) s.getItem()).color.colorValue : -1;
|
||||
IItemColor dyeHandler = (s, t) -> t == 0 ? ((Item16Colors) s.getItem()).color.colorValue : -1;
|
||||
for(DyeColor color : DyeColor.values()) {
|
||||
items.register(petalHandler, ModItems.getPetal(color));
|
||||
items.register(dyeHandler, ModItems.getDye(color));
|
||||
}
|
||||
|
||||
items.register((s, t) -> Minecraft.getInstance().getBlockColors().getColor(((BlockItem)s.getItem()).getBlock().getDefaultState(), null, null, t),
|
||||
items.register((s, t) -> t == 0 ? Minecraft.getInstance().getBlockColors().getColor(((BlockItem) s.getItem()).getBlock().getDefaultState(), null, null, t) : -1,
|
||||
ModBlocks.petalBlockWhite, ModBlocks.petalBlockOrange, ModBlocks.petalBlockMagenta, ModBlocks.petalBlockLightBlue,
|
||||
ModBlocks.petalBlockYellow, ModBlocks.petalBlockLime, ModBlocks.petalBlockPink, ModBlocks.petalBlockGray,
|
||||
ModBlocks.petalBlockSilver, ModBlocks.petalBlockCyan, ModBlocks.petalBlockPurple, ModBlocks.petalBlockBlue,
|
||||
@@ -128,7 +132,7 @@ public final class ColorHandler {
|
||||
|
||||
items.register((s, t) -> t == 1 ? MathHelper.hsvToRGB(0.528F, (float) ((ItemManaTablet) ModItems.manaTablet).getMana(s) / (float) ItemManaTablet.MAX_MANA, 1F) : -1, ModItems.manaTablet);
|
||||
|
||||
items.register((s, t) -> MathHelper.hsvToRGB(0.55F, ((float) s.getMaxDamage() - (float) s.getDamage()) / (float)s.getMaxDamage() * 0.5F, 1F), ModItems.spellCloth);
|
||||
items.register((s, t) -> t == 0 ? MathHelper.hsvToRGB(0.55F, ((float) s.getMaxDamage() - (float) s.getDamage()) / (float)s.getMaxDamage() * 0.5F, 1F) : -1, ModItems.spellCloth);
|
||||
|
||||
items.register((s, t) -> {
|
||||
if(t != 1)
|
||||
|
||||
@@ -30,6 +30,7 @@ import vazkii.botania.client.model.LexiconModel;
|
||||
import vazkii.botania.client.model.PlatformModel;
|
||||
import vazkii.botania.client.render.tile.RenderTileCorporeaCrystalCube;
|
||||
import vazkii.botania.client.render.tile.RenderTilePump;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
import vazkii.botania.common.item.relic.ItemKingKey;
|
||||
@@ -120,6 +121,10 @@ public class MiscellaneousIcons {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelBake(ModelBakeEvent evt) {
|
||||
if (!ModelHandler.registeredModels) {
|
||||
Botania.LOGGER.error("Additional models failed to register! Aborting baking models to avoid early crashing.");
|
||||
return;
|
||||
}
|
||||
// Platforms
|
||||
ModelResourceLocation abstruseName = new ModelResourceLocation("botania:abstruse_platform", "");
|
||||
IBakedModel abstruse = evt.getModelRegistry().get(abstruseName);
|
||||
|
||||
@@ -96,8 +96,12 @@ import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public final class ModelHandler {
|
||||
static boolean registeredModels = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent evt) {
|
||||
registeredModels = true;
|
||||
|
||||
ModelLoaderRegistry.registerLoader(FloatingFlowerModel.Loader.ID, FloatingFlowerModel.Loader.INSTANCE);
|
||||
ModelLoader.addSpecialModel(new ModelResourceLocation(LibMisc.MOD_ID + ":mana_gun_clip", "inventory"));
|
||||
ModelLoader.addSpecialModel(new ModelResourceLocation(LibMisc.MOD_ID + ":desu_gun", "inventory"));
|
||||
|
||||
@@ -57,7 +57,8 @@ public class RenderTilePool extends TileEntityRenderer<TilePool> {
|
||||
if (fab) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
time += new Random(pool.getPos().getX() ^ pool.getPos().getY() ^ pool.getPos().getZ()).nextInt(100000);
|
||||
int color = MathHelper.hsvToRGB(time * 0.005F, 0.6F, 1F);
|
||||
time *= 0.005F;
|
||||
int color = vazkii.botania.common.core.helper.MathHelper.multiplyColor(MathHelper.hsvToRGB(time - (int) time, 0.6F, 1F), pool.color.colorValue);
|
||||
|
||||
int red = (color & 0xFF0000) >> 16;
|
||||
int green = (color & 0xFF00) >> 8;
|
||||
|
||||
@@ -115,10 +115,13 @@ public class BlockPistonRelay extends BlockMod implements IWandable {
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(PlayerEntity player, ItemStack stack, World world, BlockPos pos, Direction side) {
|
||||
if(player == null || world.isRemote)
|
||||
if(world.isRemote)
|
||||
return false;
|
||||
|
||||
if(!player.isSneaking()) {
|
||||
if(player == null || player.isSneaking()) {
|
||||
spawnAsEntity(world, pos, new ItemStack(this));
|
||||
world.destroyBlock(pos, false);
|
||||
} else {
|
||||
GlobalPos clicked = GlobalPos.of(world.getDimension().getType(), pos.toImmutable());
|
||||
if(ItemTwigWand.getBindMode(stack)) {
|
||||
activeBindingAttempts.put(player.getUniqueID(), clicked);
|
||||
@@ -132,9 +135,6 @@ public class BlockPistonRelay extends BlockMod implements IWandable {
|
||||
dest.getX(), dest.getY(), dest.getZ()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
spawnAsEntity(world, pos, new ItemStack(this));
|
||||
world.destroyBlock(pos, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -146,15 +146,6 @@ public class BlockSpecialFlower extends FlowerBlock implements IWandable, IWandH
|
||||
|
||||
@Override
|
||||
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemDye) {
|
||||
DyeColor newColor = ((ItemDye) stack.getItem()).color;
|
||||
DyeColor oldColor = state.get(BotaniaStateProps.COLOR);
|
||||
if(newColor != oldColor)
|
||||
world.setBlockState(pos, state.with(BotaniaStateProps.COLOR, newColor));
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit);
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ public final class ModFluffBlocks {
|
||||
base = r.getValue(prefix(LibBlockNames.ELF_GLASS));
|
||||
register(r, new BlockModPane(Block.Properties.from(base)), LibBlockNames.ELF_GLASS + "_pane");
|
||||
|
||||
base = r.getValue(prefix(LibBlockNames.BIFROST));
|
||||
base = r.getValue(prefix(LibBlockNames.BIFROST_PERM));
|
||||
register(r, new BlockModPane(Block.Properties.from(base)), LibBlockNames.BIFROST + "_pane");
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class BlockTurntable extends BlockMod implements IWandable, IWandHUD {
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(PlayerEntity player, ItemStack stack, World world, BlockPos pos, Direction side) {
|
||||
((TileTurntable) world.getTileEntity(pos)).onWanded(player, stack);
|
||||
((TileTurntable) world.getTileEntity(pos)).onWanded(player, stack, side);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -199,10 +199,7 @@ public class SubTileHopperhock extends TileEntityFunctionalFlower {
|
||||
|
||||
@Override
|
||||
public boolean onWanded(PlayerEntity player, ItemStack wand) {
|
||||
if(player == null)
|
||||
return false;
|
||||
|
||||
if(player.isSneaking()) {
|
||||
if(player == null || player.isSneaking()) {
|
||||
filterType = filterType == 2 ? 0 : filterType + 1;
|
||||
sync();
|
||||
|
||||
|
||||
+3
-1
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.TNTEntity;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
@@ -43,7 +44,8 @@ public class SubTileEntropinnyum extends TileEntityGeneratingFlower {
|
||||
if(!getWorld().isRemote && getMana() == 0) {
|
||||
List<TNTEntity> tnts = getWorld().getEntitiesWithinAABB(TNTEntity.class, new AxisAlignedBB(getEffectivePos().add(-RANGE, -RANGE, -RANGE), getEffectivePos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
for(TNTEntity tnt : tnts) {
|
||||
if(tnt.getFuse() == 1 && !tnt.removed && !getWorld().getBlockState(new BlockPos(tnt)).getMaterial().isLiquid()) {
|
||||
IFluidState fluid = getWorld().getFluidState(new BlockPos(tnt));
|
||||
if(tnt.getFuse() == 1 && tnt.isAlive() && fluid.isEmpty()) {
|
||||
tnt.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 0.2F, (1F + (getWorld().rand.nextFloat() - getWorld().rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
tnt.remove();
|
||||
addMana(getMaxMana());
|
||||
|
||||
@@ -51,6 +51,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TileAlfPortal extends TileMod implements ITickableTileEntity {
|
||||
|
||||
@@ -91,12 +92,11 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
BlockState iBlockState = world.getBlockState(getPos());
|
||||
if(iBlockState.get(BotaniaStateProps.ALFPORTAL_STATE) == AlfPortalState.OFF) {
|
||||
if(getBlockState().get(BotaniaStateProps.ALFPORTAL_STATE) == AlfPortalState.OFF) {
|
||||
ticksOpen = 0;
|
||||
return;
|
||||
}
|
||||
AlfPortalState state = iBlockState.get(BotaniaStateProps.ALFPORTAL_STATE);
|
||||
AlfPortalState state = getBlockState().get(BotaniaStateProps.ALFPORTAL_STATE);
|
||||
AlfPortalState newState = getValidState();
|
||||
|
||||
ticksOpen++;
|
||||
@@ -151,7 +151,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
|
||||
if(newState == AlfPortalState.OFF)
|
||||
for(int i = 0; i < 36; i++)
|
||||
blockParticle(state);
|
||||
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.ALFPORTAL_STATE, newState));
|
||||
world.setBlockState(getPos(), getBlockState().with(BotaniaStateProps.ALFPORTAL_STATE, newState));
|
||||
} else if(explode) {
|
||||
world.createExplosion(null, pos.getX() + .5, pos.getY() + 2.0, pos.getZ() + .5,
|
||||
3f, Explosion.Mode.DESTROY);
|
||||
@@ -208,11 +208,11 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
|
||||
}
|
||||
|
||||
public boolean onWanded() {
|
||||
AlfPortalState state = world.getBlockState(getPos()).get(BotaniaStateProps.ALFPORTAL_STATE);
|
||||
AlfPortalState state = getBlockState().get(BotaniaStateProps.ALFPORTAL_STATE);
|
||||
if(state == AlfPortalState.OFF) {
|
||||
AlfPortalState newState = getValidState();
|
||||
if(newState != AlfPortalState.OFF) {
|
||||
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.ALFPORTAL_STATE, newState));
|
||||
world.setBlockState(getPos(), getBlockState().with(BotaniaStateProps.ALFPORTAL_STATE, newState));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
|
||||
|
||||
private AxisAlignedBB getPortalAABB() {
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(pos.add(-1, 1, 0), pos.add(2, 4, 1));
|
||||
if(world.getBlockState(getPos()).get(BotaniaStateProps.ALFPORTAL_STATE) == AlfPortalState.ON_X)
|
||||
if(getBlockState().get(BotaniaStateProps.ALFPORTAL_STATE) == AlfPortalState.ON_X)
|
||||
aabb = new AxisAlignedBB(pos.add(0, 1, -1), pos.add(1, 4, 2));
|
||||
|
||||
return aabb;
|
||||
@@ -317,20 +317,15 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
|
||||
}
|
||||
|
||||
public List<BlockPos> locatePylons() {
|
||||
List<BlockPos> list = new ArrayList<>();
|
||||
int range = 5;
|
||||
|
||||
BlockState pylonState = ModBlocks.naturaPylon.getDefaultState();
|
||||
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -range; j < range + 1; j++)
|
||||
for(int k = -range; k < range + 1; k++) {
|
||||
BlockPos pos = getPos().add(i, j, k);
|
||||
if(world.getBlockState(pos) == pylonState && world.getBlockState(pos.down()).getBlock() instanceof BlockPool)
|
||||
list.add(pos);
|
||||
}
|
||||
|
||||
return list;
|
||||
return BlockPos.getAllInBox(getPos().add(-range, -range, -range), getPos().add(range, range, range))
|
||||
.filter(world::isBlockLoaded)
|
||||
.filter(p -> world.getBlockState(p) == pylonState && world.getBlockState(p.down()).getBlock() instanceof BlockPool)
|
||||
.map(BlockPos::toImmutable)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void lightPylons() {
|
||||
|
||||
@@ -121,13 +121,13 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
|
||||
if(!drainWater.isEmpty() && drainWater.getFluid() == Fluids.WATER && drainWater.getAmount() == FluidAttributes.BUCKET_VOLUME) {
|
||||
setFluid(Fluids.WATER);
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
fluidHandler.drain(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
|
||||
item.setItem(fluidHandler.getContainer());
|
||||
return true;
|
||||
} else if(!drainLava.isEmpty() && drainLava.getFluid() == Fluids.LAVA && drainLava.getAmount() == FluidAttributes.BUCKET_VOLUME) {
|
||||
setFluid(Fluids.LAVA);
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
fluidHandler.drain(new FluidStack(Fluids.LAVA, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
|
||||
item.setItem(fluidHandler.getContainer());
|
||||
return true;
|
||||
@@ -158,7 +158,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
world.addEntity(outputItem);
|
||||
|
||||
setFluid(Fluids.EMPTY);
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
|
||||
world.addBlockEvent(getPos(), getBlockState().getBlock(), CRAFT_EFFECT_EVENT, 0);
|
||||
|
||||
@@ -219,8 +219,8 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack pstack = player.inventory.getStackInSlot(i);
|
||||
if(!pstack.isEmpty() && pstack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(stack, pstack)) {
|
||||
inv.setStackInSlot(index, pstack.split(1));
|
||||
if(player.isCreative() || (!pstack.isEmpty() && pstack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(stack, pstack))) {
|
||||
inv.setStackInSlot(index, player.isCreative() ? stack.copy() : pstack.split(1));
|
||||
didAny = true;
|
||||
index++;
|
||||
break;
|
||||
|
||||
@@ -123,7 +123,7 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ITic
|
||||
|
||||
@Override
|
||||
public Direction getAvatarFacing() {
|
||||
return world.getBlockState(getPos()).get(BlockStateProperties.HORIZONTAL_FACING);
|
||||
return getBlockState().get(BlockStateProperties.HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -159,7 +159,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
|
||||
|
||||
if(newSignal != signal) {
|
||||
signal = newSignal;
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
}
|
||||
|
||||
manaLastTick = mana;
|
||||
|
||||
@@ -85,7 +85,8 @@ public class TileCocoon extends TileMod implements ITickableTileEntity{
|
||||
for (Direction d : Direction.values()) {
|
||||
if (d != Direction.UP) {
|
||||
BlockPos blockPos = pos.offset(d);
|
||||
if (world.getBlockState(blockPos).getBlock() == Blocks.WATER) {
|
||||
if (world.isBlockLoaded(blockPos)
|
||||
&& world.getBlockState(blockPos).getBlock() == Blocks.WATER) {
|
||||
validWater.add(blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
|
||||
if(newSignal != signal) {
|
||||
signal = newSignal;
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
BlockState state = world.getBlockState(getPos());
|
||||
BlockState state = getBlockState();
|
||||
Direction.Axis axis = state.get(BotaniaStateProps.ENCHANTER_DIRECTION);
|
||||
|
||||
for(BlockPos pylon : PYLON_LOCATIONS.get(axis)) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TileEnderEye extends TileMod implements ITickableTileEntity {
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
boolean wasLooking = world.getBlockState(getPos()).get(BotaniaStateProps.POWERED);
|
||||
boolean wasLooking = getBlockState().get(BotaniaStateProps.POWERED);
|
||||
int range = 80;
|
||||
List<PlayerEntity> players = world.getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range, range, range)));
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TileEnderEye extends TileMod implements ITickableTileEntity {
|
||||
}
|
||||
|
||||
if(looking != wasLooking)
|
||||
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.POWERED, looking));
|
||||
world.setBlockState(getPos(), getBlockState().with(BotaniaStateProps.POWERED, looking));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class TileForestEye extends TileMod implements ITickableTileEntity {
|
||||
int entityCount = world.getEntitiesWithinAABB(AnimalEntity.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range + 1, range + 1, range + 1))).size();
|
||||
if(entityCount != entities) {
|
||||
entities = entityCount;
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class TileHourglass extends TileSimpleInventory implements ITickableTileE
|
||||
flip = !flip;
|
||||
flipTicks = 4;
|
||||
if(!world.isRemote) {
|
||||
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.POWERED, true), 1);
|
||||
world.setBlockState(getPos(), getBlockState().with(BotaniaStateProps.POWERED, true), 1);
|
||||
world.getPendingBlockTicks().scheduleTick(pos, getBlockState().getBlock(), getBlockState().getBlock().tickRate(world));
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
|
||||
BlockPos endpoint = getEndpoint();
|
||||
|
||||
if(endpoint != null) {
|
||||
AxisAlignedBB aabb = world.getBlockState(pos).getShape(world, pos).getBoundingBox().offset(pos);
|
||||
AxisAlignedBB aabb = getBlockState().getShape(world, pos).getBoundingBox().offset(pos);
|
||||
float range = 0.5F;
|
||||
List<EnderPearlEntity> enderPearls = world.getEntitiesWithinAABB(EnderPearlEntity.class, aabb.grow(range));
|
||||
for(EnderPearlEntity pearl : enderPearls) {
|
||||
@@ -183,7 +183,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
|
||||
}
|
||||
|
||||
public BlockPos getNextDestination() {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
BlockState state = getBlockState();
|
||||
if(state.getBlock() == ModBlocks.lightRelayToggle && state.get(BotaniaStateProps.POWERED))
|
||||
return null;
|
||||
else if(state.getBlock() == ModBlocks.lightRelayFork) {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class TilePlatform extends TileMod {
|
||||
|
||||
private void swap(TilePlatform tile, boolean empty) {
|
||||
tile.camoState = empty ? null : camoState;
|
||||
world.notifyBlockUpdate(tile.getPos(), world.getBlockState(tile.getPos()), world.getBlockState(tile.getPos()), 3);
|
||||
world.notifyBlockUpdate(tile.getPos(), tile.getBlockState(), tile.getBlockState(), 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -159,7 +159,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
|
||||
|
||||
if(newSignal != signal) {
|
||||
signal = newSignal;
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
}
|
||||
|
||||
updateRecipe();
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TileSparkChanger extends TileSimpleInventory {
|
||||
if(transfers != null)
|
||||
transfers.clear();
|
||||
itemHandler.setStackInSlot(0, sparkStack);
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable, ITickab
|
||||
else item.setItem(new ItemStack(ModItems.terrasteel));
|
||||
world.playSound(null, item.getX(), item.getY(), item.getZ(), ModSounds.terrasteelCraft, SoundCategory.BLOCKS, 1, 1);
|
||||
mana = 0;
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable, ITickab
|
||||
@Override
|
||||
public void recieveMana(int mana) {
|
||||
this.mana = Math.max(0, Math.min(MAX_MANA, this.mana + mana));
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TileTeruTeruBozu extends TileMod implements ITickableTileEntity {
|
||||
}
|
||||
|
||||
if(wasRaining != isRaining)
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
wasRaining = isRaining;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
int oldCompValue = compValue;
|
||||
compValue = CorporeaHelper.signalStrengthForRequestSize(itemCount);
|
||||
if(compValue != oldCompValue)
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -49,8 +49,8 @@ public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorpor
|
||||
for(ItemStack stack_ : stacks)
|
||||
missing -= stack_.getCount();
|
||||
|
||||
if(missing > 0 && !world.getBlockState(getPos()).get(BotaniaStateProps.POWERED)) {
|
||||
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.POWERED, true));
|
||||
if(missing > 0 && !getBlockState().get(BotaniaStateProps.POWERED)) {
|
||||
world.setBlockState(getPos(), getBlockState().with(BotaniaStateProps.POWERED, true));
|
||||
world.getPendingBlockTicks().scheduleTick(getPos(), getBlockState().getBlock(), getBlockState().getBlock().tickRate(world));
|
||||
|
||||
TileEntity requestor = source.getSparkInventory().world.getTileEntity(source.getSparkInventory().pos);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TileCorporeaRetainer extends TileMod {
|
||||
this.requestCount = requestCount;
|
||||
|
||||
compValue = CorporeaHelper.signalStrengthForRequestSize(requestCount);
|
||||
world.updateComparatorOutputLevel(getPos(), world.getBlockState(getPos()).getBlock());
|
||||
world.updateComparatorOutputLevel(getPos(), getBlockState().getBlock());
|
||||
}
|
||||
|
||||
public int getComparatorValue() {
|
||||
@@ -93,7 +93,7 @@ public class TileCorporeaRetainer extends TileMod {
|
||||
request = null;
|
||||
requestCount = 0;
|
||||
compValue = 0;
|
||||
world.updateComparatorOutputLevel(getPos(), world.getBlockState(getPos()).getBlock());
|
||||
world.updateComparatorOutputLevel(getPos(), getBlockState().getBlock());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class TileBellows extends TileMod implements ITickableTileEntity {
|
||||
}
|
||||
|
||||
public TileEntity getLinkedTile() {
|
||||
Direction side = world.getBlockState(getPos()).get(BlockStateProperties.HORIZONTAL_FACING);
|
||||
Direction side = getBlockState().get(BlockStateProperties.HORIZONTAL_FACING);
|
||||
return world.getTileEntity(getPos().offset(side));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ public class TileManaDetector extends TileMod implements ITickableTileEntity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
boolean state = world.getBlockState(getPos()).get(BotaniaStateProps.POWERED);
|
||||
boolean state = getBlockState().get(BotaniaStateProps.POWERED);
|
||||
boolean expectedState = world.getEntitiesWithinAABB(ThrowableEntity.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)), Predicates.instanceOf(IManaBurst.class)).size() != 0;
|
||||
if(state != expectedState && !world.isRemote)
|
||||
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.POWERED, expectedState));
|
||||
world.setBlockState(getPos(), getBlockState().with(BotaniaStateProps.POWERED, expectedState));
|
||||
|
||||
if(expectedState)
|
||||
for(int i = 0; i < 4; i++) {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
this.mana = Math.max(0, Math.min(getCurrentMana() + mana, manaCap));
|
||||
if(old != this.mana) {
|
||||
markDirty();
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
markDispatchable();
|
||||
}
|
||||
}
|
||||
@@ -374,10 +374,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
}
|
||||
|
||||
public void onWanded(PlayerEntity player, ItemStack wand) {
|
||||
if(player == null)
|
||||
return;
|
||||
|
||||
if(player.isSneaking()) {
|
||||
if(player == null || player.isSneaking()) {
|
||||
outputting = !outputting;
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
}
|
||||
@@ -390,7 +387,11 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
((ServerPlayerEntity) player).connection.sendPacket(new SUpdateTileEntityPacket(pos, -999, nbttagcompound));
|
||||
}
|
||||
|
||||
world.playSound(null, player.getX(), player.getY(), player.getZ(), ModSounds.ding, SoundCategory.PLAYERS, 0.11F, 1F);
|
||||
if(player == null) {
|
||||
world.playSound(null, getPos(), ModSounds.ding, SoundCategory.PLAYERS, 0.11F, 1F);
|
||||
} else {
|
||||
world.playSound(null, player.getX(), player.getY(), player.getZ(), ModSounds.ding, SoundCategory.PLAYERS, 0.11F, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TilePrism extends TileSimpleInventory {
|
||||
|
||||
public void onBurstCollision(IManaBurst burst) {
|
||||
ItemStack lens = itemHandler.getStackInSlot(0);
|
||||
boolean active = !world.getBlockState(getPos()).get(BotaniaStateProps.POWERED);
|
||||
boolean active = !getBlockState().get(BotaniaStateProps.POWERED);
|
||||
boolean valid = !lens.isEmpty() && lens.getItem() instanceof ILens && (!(lens.getItem() instanceof ITinyPlanetExcempt) || ((ITinyPlanetExcempt) lens.getItem()).shouldPull(lens));
|
||||
|
||||
if(active) {
|
||||
@@ -87,7 +87,7 @@ public class TilePrism extends TileSimpleInventory {
|
||||
super.markDirty();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
if(world != null && !world.isRemote) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
BlockState state = getBlockState();
|
||||
boolean hasLens = !itemHandler.getStackInSlot(0).isEmpty();
|
||||
if (state.getBlock() != ModBlocks.prism || state.get(BotaniaStateProps.HAS_LENS) != hasLens) {
|
||||
BlockState base = state.getBlock() == ModBlocks.prism ? state : ModBlocks.prism.getDefaultState();
|
||||
|
||||
@@ -97,7 +97,7 @@ public class TilePump extends TileMod implements ITickableTileEntity {
|
||||
hasCartOnTop = false;
|
||||
|
||||
if(comparator != lastComparator)
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
lastComparator = comparator;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,11 +77,8 @@ public class TileTurntable extends TileMod implements ITickableTileEntity {
|
||||
backwards = cmp.getBoolean(TAG_BACKWARDS);
|
||||
}
|
||||
|
||||
public void onWanded(PlayerEntity player, ItemStack wand) {
|
||||
if(player == null)
|
||||
return;
|
||||
|
||||
if(player.isSneaking())
|
||||
public void onWanded(PlayerEntity player, ItemStack wand, Direction side) {
|
||||
if((player != null && player.isSneaking()) || (player == null && side == Direction.DOWN))
|
||||
backwards = !backwards;
|
||||
else speed = speed == 6 ? 1 : speed + 1;
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TileRedStringComparator extends TileRedString {
|
||||
} else comparatorValue = 0;
|
||||
|
||||
if(origVal != comparatorValue)
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
|
||||
}
|
||||
|
||||
public int getComparatorValue() {
|
||||
|
||||
@@ -33,6 +33,19 @@ public final class MathHelper {
|
||||
entity.setMotion(finalVector.multiply(modifier).toVec3D());
|
||||
}
|
||||
|
||||
public static int multiplyColor(int c1, int c2) {
|
||||
int r1 = (c1 & 0xFF0000) >> 16;
|
||||
int r2 = (c2 & 0xFF0000) >> 16;
|
||||
int g1 = (c1 & 0x00FF00) >> 8;
|
||||
int g2 = (c2 & 0x00FF00) >> 8;
|
||||
int b1 = (c1 & 0x0000FF);
|
||||
int b2 = (c2 & 0x0000FF);
|
||||
int r = (int)(r1 * (r2 / 255.0F));
|
||||
int g = (int)(g1 * (g2 / 255.0F));
|
||||
int b = (int)(b1 * (b2 / 255.0F));
|
||||
return c1 & ~0xFFFFFF | r << 16 | g << 8 | b;
|
||||
}
|
||||
|
||||
private static final String[] ORDINAL_SUFFIXES = new String[]{ "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
|
||||
public static String numberToOrdinal(int i) {
|
||||
return i % 100 == 11 || i % 100 == 12 || i % 100 == 13 ? i + "th" : i + ORDINAL_SUFFIXES[i % 10];
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
@@ -38,7 +39,7 @@ public class ItemKeepIvy extends Item {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public static void onPlayerDrops(LivingDropsEvent event) {
|
||||
if(!(event.getEntityLiving() instanceof PlayerEntity))
|
||||
return;
|
||||
|
||||
@@ -982,7 +982,9 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider {
|
||||
.addCriterion("has_item", hasItem(ModTags.Items.PETALS))
|
||||
.build(WrapperResult.ofType(TwigWandRecipe.SERIALIZER, consumer));
|
||||
ShapedRecipeBuilder.shapedRecipe(ModItems.manaTablet)
|
||||
.key('P', ModTags.Items.GEMS_MANA_DIAMOND)
|
||||
.key('P', Ingredient.fromItemListStream(Stream.of(
|
||||
new Ingredient.SingleItemList(new ItemStack(ModItems.manaPearl)),
|
||||
new Ingredient.TagList(ModTags.Items.GEMS_MANA_DIAMOND))))
|
||||
.key('S', ModTags.Items.LIVINGROCK)
|
||||
.patternLine("SSS")
|
||||
.patternLine("SPS")
|
||||
@@ -2053,13 +2055,13 @@ public class RecipeProvider extends net.minecraft.data.RecipeProvider {
|
||||
|
||||
private void registerFloatingFlowers(Consumer<IFinishedRecipe> consumer) {
|
||||
for (Block block : new Block[]{
|
||||
ModSubtiles.pureDaisy, ModSubtiles.manastar, ModSubtiles.hydroangeas, ModSubtiles.thermalily,
|
||||
ModSubtiles.rosaArcana, ModSubtiles.munchdew, ModSubtiles.entropinnyum, ModSubtiles.kekimurus,
|
||||
ModSubtiles.gourmaryllis, ModSubtiles.narslimmus, ModSubtiles.spectrolus, ModSubtiles.dandelifeon,
|
||||
ModSubtiles.rafflowsia, ModSubtiles.shulkMeNot, ModSubtiles.bellethorn, ModSubtiles.bellethornChibi,
|
||||
ModSubtiles.bergamute, ModSubtiles.dreadthorn, ModSubtiles.heiseiDream, ModSubtiles.tigerseye,
|
||||
ModSubtiles.jadedAmaranthus, ModSubtiles.orechid, ModSubtiles.fallenKanade, ModSubtiles.exoflame,
|
||||
ModSubtiles.agricarnation, ModSubtiles.agricarnationChibi, ModSubtiles.hopperhock,
|
||||
ModSubtiles.pureDaisy, ModSubtiles.manastar, ModSubtiles.hydroangeas, ModSubtiles.endoflame,
|
||||
ModSubtiles.thermalily, ModSubtiles.rosaArcana, ModSubtiles.munchdew, ModSubtiles.entropinnyum,
|
||||
ModSubtiles.kekimurus, ModSubtiles.gourmaryllis, ModSubtiles.narslimmus, ModSubtiles.spectrolus,
|
||||
ModSubtiles.dandelifeon, ModSubtiles.rafflowsia, ModSubtiles.shulkMeNot, ModSubtiles.bellethorn,
|
||||
ModSubtiles.bellethornChibi, ModSubtiles.bergamute, ModSubtiles.dreadthorn, ModSubtiles.heiseiDream,
|
||||
ModSubtiles.tigerseye, ModSubtiles.jadedAmaranthus, ModSubtiles.orechid, ModSubtiles.fallenKanade,
|
||||
ModSubtiles.exoflame, ModSubtiles.agricarnation, ModSubtiles.agricarnationChibi, ModSubtiles.hopperhock,
|
||||
ModSubtiles.hopperhockChibi, ModSubtiles.tangleberrie, ModSubtiles.jiyuulia, ModSubtiles.rannuncarpus,
|
||||
ModSubtiles.rannuncarpusChibi, ModSubtiles.hyacidus, ModSubtiles.pollidisiac, ModSubtiles.clayconia,
|
||||
ModSubtiles.clayconiaChibi, ModSubtiles.loonium, ModSubtiles.daffomill, ModSubtiles.vinculotus,
|
||||
|
||||
Reference in new issue
Block a user