mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 10:55:17 +00:00
Pass through subtiles
This commit is contained in:
1 parent
070093c9e5
commit
0f8625adff
20 files changed
+108
-58
No files matched your search
@@ -84,9 +84,9 @@ public class SubTilePureDaisy extends TileEntitySpecialFlower {
|
||||
BlockPos coords = getPos().add(acoords);
|
||||
World world = getWorld();
|
||||
if(!world.isAirBlock(coords)) {
|
||||
world.profiler.startSection("findRecipe");
|
||||
world.getProfiler().startSection("findRecipe");
|
||||
RecipePureDaisy recipe = findRecipe(coords);
|
||||
world.profiler.endSection();
|
||||
world.getProfiler().endSection();
|
||||
|
||||
if(recipe != null) {
|
||||
if (ticksRemaining[positionAt] == -1)
|
||||
|
||||
+1
-3
@@ -84,8 +84,7 @@ public class BergamuteEventHandler {
|
||||
@Nonnull @Override public Sound getSound() { return compose.getSound(); }
|
||||
@Nonnull @Override public SoundCategory getCategory() { return compose.getCategory(); }
|
||||
@Override public boolean canRepeat() { return compose.canRepeat(); }
|
||||
@Override public boolean isPriority() { return compose.isPriority(); }
|
||||
|
||||
@Override public boolean func_217861_m() { return compose.func_217861_m(); }
|
||||
@Override public int getRepeatDelay() { return compose.getRepeatDelay(); }
|
||||
@Override public float getPitch() { return compose.getPitch(); }
|
||||
@Override public float getX() { return compose.getX(); }
|
||||
@@ -106,6 +105,5 @@ public class BergamuteEventHandler {
|
||||
|
||||
@Override public boolean isDonePlaying() { return compose.isDonePlaying(); }
|
||||
@Override public void tick() { compose.tick(); }
|
||||
@Override public boolean isPriority() { return compose.isPriority(); }
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -97,7 +97,9 @@ public class SubTileAgricarnation extends TileEntityFunctionalFlower {
|
||||
return false;
|
||||
|
||||
Material mat = state.getMaterial();
|
||||
return mat != null && (mat == Material.PLANTS || mat == Material.CACTUS || mat == Material.GRASS || mat == Material.LEAVES || mat == Material.GOURD) && block instanceof IGrowable && ((IGrowable) block).canGrow(getWorld(), pos, getWorld().getBlockState(pos), getWorld().isRemote);
|
||||
return (mat == Material.PLANTS || mat == Material.CACTUS || mat == Material.ORGANIC || mat == Material.LEAVES || mat == Material.GOURD)
|
||||
&& block instanceof IGrowable
|
||||
&& ((IGrowable) block).canGrow(getWorld(), pos, getWorld().getBlockState(pos), getWorld().isRemote);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SubTileClayconia extends TileEntityFunctionalFlower {
|
||||
if(mana >= COST) {
|
||||
BlockPos coords = getCoordsToPut();
|
||||
if(coords != null) {
|
||||
getWorld().removeBlock(coords);
|
||||
getWorld().removeBlock(coords, false);
|
||||
if(ConfigHandler.COMMON.blockBreakParticles.get())
|
||||
getWorld().playEvent(2001, coords, Block.getStateId(Blocks.SAND.getDefaultState()));
|
||||
ItemEntity item = new ItemEntity(getWorld(), coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, new ItemStack(Items.CLAY_BALL));
|
||||
|
||||
@@ -77,9 +77,11 @@ public class SubTileDaffomill extends TileEntityFunctionalFlower {
|
||||
int slowdown = getSlowdownFactor();
|
||||
for(ItemEntity item : items) {
|
||||
if(item.isAlive() && item.age >= slowdown) {
|
||||
item.motionX += orientation.getXOffset() * 0.05;
|
||||
item.motionY += orientation.getYOffset() * 0.05;
|
||||
item.motionZ += orientation.getZOffset() * 0.05;
|
||||
item.setMotion(
|
||||
item.getMotion().getX() + orientation.getXOffset() * 0.05,
|
||||
item.getMotion().getY() + orientation.getYOffset() * 0.05,
|
||||
item.getMotion().getZ() + orientation.getZOffset() * 0.05
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.FurnaceTileEntity;
|
||||
@@ -30,6 +32,8 @@ import vazkii.botania.common.block.ModSubtiles;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class SubTileExoflame extends TileEntityFunctionalFlower {
|
||||
@ObjectHolder(LibMisc.MOD_ID + ":exoflame")
|
||||
public static TileEntityType<SubTileExoflame> TYPE;
|
||||
@@ -51,7 +55,8 @@ public class SubTileExoflame extends TileEntityFunctionalFlower {
|
||||
|
||||
boolean did = false;
|
||||
|
||||
for(BlockPos pos : BlockPos.getAllInBox(getPos().add(-RANGE, -RANGE_Y, -RANGE), getPos().add(RANGE, RANGE_Y, RANGE))) {
|
||||
for(BlockPos pos : BlockPos.getAllInBoxMutable(getPos().add(-RANGE, -RANGE_Y, -RANGE),
|
||||
getPos().add(RANGE, RANGE_Y, RANGE))) {
|
||||
TileEntity tile = getWorld().getTileEntity(pos);
|
||||
BlockState state = getWorld().getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
@@ -101,11 +106,14 @@ public class SubTileExoflame extends TileEntityFunctionalFlower {
|
||||
if(furnace.getStackInSlot(0).isEmpty())
|
||||
return false;
|
||||
else {
|
||||
ItemStack itemstack = furnace.getWorld().getRecipeManager().getResult(furnace, furnace.getWorld(), VanillaRecipeTypes.SMELTING);;
|
||||
Optional<ItemStack> maybeStack = furnace.getWorld().getRecipeManager()
|
||||
.getRecipe(IRecipeType.SMELTING, furnace, furnace.getWorld())
|
||||
.map(IRecipe::getRecipeOutput);
|
||||
|
||||
if(itemstack.isEmpty())
|
||||
if(!maybeStack.isPresent() || maybeStack.get().isEmpty())
|
||||
return false;
|
||||
|
||||
ItemStack itemstack = maybeStack.get();
|
||||
if(furnace.getStackInSlot(2).isEmpty())
|
||||
return true;
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.SpawnReason;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
@@ -43,9 +45,12 @@ import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraft.world.storage.loot.LootContext;
|
||||
import net.minecraft.world.storage.loot.LootParameterSet;
|
||||
import net.minecraft.world.storage.loot.LootParameterSets;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
@@ -89,7 +94,9 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
|
||||
|
||||
ItemStack stack;
|
||||
do {
|
||||
List<ItemStack> stacks = ((ServerWorld) world).getServer().getLootTableManager().getLootTableFromLocation(lootTable).generateLootForPools(rand, new LootContext.Builder((ServerWorld) world).build());
|
||||
LootContext ctx = new LootContext.Builder((ServerWorld) world).build(LootParameterSets.EMPTY);
|
||||
List<ItemStack> stacks = ((ServerWorld) world).getServer().getLootTableManager()
|
||||
.getLootTableFromLocation(lootTable).generate(ctx);
|
||||
if (stacks.isEmpty())
|
||||
return;
|
||||
else {
|
||||
@@ -108,7 +115,7 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
|
||||
pos = pos.up();
|
||||
if(pos.getY() >= 254)
|
||||
return;
|
||||
} while(world.getBlockState(pos).causesSuffocation());
|
||||
} while(world.getBlockState(pos).causesSuffocation(world, pos));
|
||||
pos = pos.up();
|
||||
|
||||
double x = pos.getX() + Math.random();
|
||||
@@ -117,45 +124,49 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
|
||||
|
||||
MonsterEntity entity = null;
|
||||
if(world.rand.nextInt(50) == 0)
|
||||
entity = new EndermanEntity(world);
|
||||
entity = new EndermanEntity(EntityType.ENDERMAN, world);
|
||||
else if(world.rand.nextInt(10) == 0) {
|
||||
entity = new CreeperEntity(world);
|
||||
entity = new CreeperEntity(EntityType.CREEPER, world);
|
||||
if(world.rand.nextInt(200) == 0)
|
||||
entity.onStruckByLightning(null);
|
||||
} else
|
||||
switch(world.rand.nextInt(3)) {
|
||||
case 0:
|
||||
if(world.rand.nextInt(10) == 0)
|
||||
entity = new HuskEntity(world);
|
||||
entity = new HuskEntity(EntityType.HUSK, world);
|
||||
else entity = new ZombieEntity(world);
|
||||
break;
|
||||
case 1:
|
||||
if(world.rand.nextInt(10) == 0)
|
||||
entity = new StrayEntity(world);
|
||||
else entity = new SkeletonEntity(world);
|
||||
entity = new StrayEntity(EntityType.STRAY, world);
|
||||
else entity = new SkeletonEntity(EntityType.SKELETON, world);
|
||||
break;
|
||||
case 2:
|
||||
if(world.rand.nextInt(10) == 0)
|
||||
entity = new CaveSpiderEntity(world);
|
||||
else entity = new SpiderEntity(world);
|
||||
entity = new CaveSpiderEntity(EntityType.CAVE_SPIDER, world);
|
||||
else entity = new SpiderEntity(EntityType.SPIDER, world);
|
||||
break;
|
||||
}
|
||||
|
||||
entity.setPositionAndRotation(x, y, z, world.rand.nextFloat() * 360F, 0);
|
||||
entity.motionX = entity.motionY = entity.motionZ = 0;
|
||||
|
||||
Multimap map = HashMultimap.create();
|
||||
map.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier("Loonium Modififer Health", 2, 1));
|
||||
map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier("Loonium Modififer Damage", 1.5, 1));
|
||||
entity.getAttributeMap().applyAttributeModifiers(map);
|
||||
entity.setMotion(Vec3d.ZERO);
|
||||
|
||||
entity.addPotionEffect(new EffectInstance(Effects.FIRE_RESISTANCE, entity instanceof CreeperEntity ? 100 : Integer.MAX_VALUE, 0));
|
||||
entity.addPotionEffect(new EffectInstance(Effects.REGENERATION, entity instanceof CreeperEntity ? 100 : Integer.MAX_VALUE, 0));
|
||||
Multimap<String, AttributeModifier> map = HashMultimap.create();
|
||||
map.put(SharedMonsterAttributes.MAX_HEALTH.getName(),
|
||||
new AttributeModifier("Loonium Modififer Health", 2, AttributeModifier.Operation.MULTIPLY_BASE));
|
||||
map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(),
|
||||
new AttributeModifier("Loonium Modififer Damage", 1.5, AttributeModifier.Operation.MULTIPLY_BASE));
|
||||
entity.getAttributes().applyAttributeModifiers(map);
|
||||
|
||||
entity.addPotionEffect(new EffectInstance(Effects.FIRE_RESISTANCE,
|
||||
entity instanceof CreeperEntity ? 100 : Integer.MAX_VALUE, 0));
|
||||
entity.addPotionEffect(new EffectInstance(Effects.REGENERATION,
|
||||
entity instanceof CreeperEntity ? 100 : Integer.MAX_VALUE, 0));
|
||||
|
||||
CompoundNBT cmp = stack.write(new CompoundNBT());
|
||||
entity.getEntityData().put(TAG_ITEMSTACK_TO_DROP, cmp);
|
||||
|
||||
entity.onInitialSpawn(world.getDifficultyForLocation(pos), null, null);
|
||||
entity.onInitialSpawn(world, world.getDifficultyForLocation(pos), SpawnReason.SPAWNER, null, null);
|
||||
world.addEntity(entity);
|
||||
entity.spawnExplosionParticle();
|
||||
|
||||
|
||||
+3
-2
@@ -124,10 +124,11 @@ public class SubTileMarimorphosis extends TileEntityFunctionalFlower {
|
||||
int rangeY = getRangeY();
|
||||
|
||||
BlockStateMatcher matcher = BlockStateMatcher.forBlock(Blocks.STONE);
|
||||
for(BlockPos pos : BlockPos.getAllInBox(getPos().add(-range, -rangeY, -range), getPos().add(range, rangeY, range))) {
|
||||
for(BlockPos pos : BlockPos.getAllInBoxMutable(getPos().add(-range, -rangeY, -range),
|
||||
getPos().add(range, rangeY, range))) {
|
||||
BlockState state = getWorld().getBlockState(pos);
|
||||
if(state.getBlock().isReplaceableOreGen(state, getWorld(), pos, matcher))
|
||||
possibleCoords.add(pos);
|
||||
possibleCoords.add(pos.toImmutable());
|
||||
}
|
||||
|
||||
if(possibleCoords.isEmpty())
|
||||
|
||||
@@ -104,10 +104,11 @@ public class SubTileOrechid extends TileEntityFunctionalFlower {
|
||||
private BlockPos getCoordsToPut() {
|
||||
List<BlockPos> possibleCoords = new ArrayList<>();
|
||||
|
||||
for(BlockPos pos : BlockPos.getAllInBox(getPos().add(-RANGE, -RANGE_Y, -RANGE), getPos().add(RANGE, RANGE_Y, RANGE))) {
|
||||
for(BlockPos pos : BlockPos.getAllInBoxMutable(getPos().add(-RANGE, -RANGE_Y, -RANGE),
|
||||
getPos().add(RANGE, RANGE_Y, RANGE))) {
|
||||
BlockState state = getWorld().getBlockState(pos);
|
||||
if(state.getBlock().isReplaceableOreGen(state, getWorld(), pos, getReplaceMatcher()))
|
||||
possibleCoords.add(pos);
|
||||
possibleCoords.add(pos.toImmutable());
|
||||
}
|
||||
|
||||
if(possibleCoords.isEmpty())
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class SubTilePollidisiac extends TileEntityFunctionalFlower {
|
||||
|
||||
mana -= manaCost;
|
||||
|
||||
animal.inLove = 1200;
|
||||
animal.setInLove(1200);
|
||||
getWorld().setEntityState(animal, (byte)18);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-5
@@ -23,8 +23,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -88,7 +91,8 @@ public class SubTileRannuncarpus extends TileEntityFunctionalFlower {
|
||||
if(stackItem instanceof BlockItem || stackItem instanceof IFlowerPlaceable) {
|
||||
if(!validPositions.isEmpty()) {
|
||||
BlockPos coords = validPositions.get(getWorld().rand.nextInt(validPositions.size()));
|
||||
BlockItemUseContext ctx = new RannuncarpusPlaceContext(getWorld(), stack, coords, Direction.UP, 0, 0, 0);
|
||||
BlockRayTraceResult ray = new BlockRayTraceResult(Vec3d.ZERO, Direction.UP, coords, false);
|
||||
BlockItemUseContext ctx = new RannuncarpusPlaceContext(getWorld(), stack, ray);
|
||||
|
||||
boolean success = false;
|
||||
if(stackItem instanceof IFlowerPlaceable) {
|
||||
@@ -124,9 +128,10 @@ public class SubTileRannuncarpus extends TileEntityFunctionalFlower {
|
||||
BlockState filter = getUnderlyingBlock();
|
||||
List<BlockPos> ret = new ArrayList<>();
|
||||
|
||||
for (BlockPos pos_ : BlockPos.getAllInBox(pos.add(-rangePlace, -rangePlaceY, -rangePlace), pos.add(rangePlace, rangePlaceY, rangePlace))) {
|
||||
for (BlockPos pos_ : BlockPos.getAllInBoxMutable(pos.add(-rangePlace, -rangePlaceY, -rangePlace),
|
||||
pos.add(rangePlace, rangePlaceY, rangePlace))) {
|
||||
if (filter == getWorld().getBlockState(pos_))
|
||||
ret.add(pos_);
|
||||
ret.add(pos_.toImmutable());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -207,8 +212,8 @@ public class SubTileRannuncarpus extends TileEntityFunctionalFlower {
|
||||
private static class RannuncarpusPlaceContext extends BlockItemUseContext {
|
||||
private final Direction[] lookDirs;
|
||||
|
||||
public RannuncarpusPlaceContext(World world, ItemStack stack, BlockPos pos, Direction side, float hitX, float hitY, float hitZ) {
|
||||
super(world, null, stack, pos, side, hitX, hitY, hitZ);
|
||||
public RannuncarpusPlaceContext(World world, ItemStack stack, BlockRayTraceResult rtr) {
|
||||
super(world, null, Hand.MAIN_HAND, stack, rtr);
|
||||
List<Direction> tmp = Arrays.asList(Direction.values());
|
||||
Collections.shuffle(tmp);
|
||||
lookDirs = tmp.toArray(new Direction[6]);
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
@@ -85,7 +86,7 @@ public class SubTileSpectranthemum extends TileEntityFunctionalFlower {
|
||||
spawnExplosionParticles(item, 10);
|
||||
item.setPosition(bindPos.getX() + 0.5, bindPos.getY() + 1.5, bindPos.getZ() + 0.5);
|
||||
item.getEntityData().putBoolean(TAG_TELEPORTED, true);
|
||||
item.motionX = item.motionY = item.motionZ = 0;
|
||||
item.setMotion(Vec3d.ZERO);
|
||||
spawnExplosionParticles(item, 10);
|
||||
mana -= cost;
|
||||
did = true;
|
||||
|
||||
+4
-1
@@ -68,7 +68,10 @@ public class SubTileTangleberrie extends TileEntityFunctionalFlower {
|
||||
if(distance > maxDist && distance < range) {
|
||||
MathHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), getMotionVelocity());
|
||||
if(getWorld().rand.nextInt(3) == 0)
|
||||
Botania.proxy.sparkleFX(x2 + Math.random() * entity.width, y2 + Math.random() * entity.height, z2 + Math.random() * entity.width, 0.5F, 0.5F, 0.5F, 1F, 3);
|
||||
Botania.proxy.sparkleFX(x2 + Math.random() * entity.getWidth(),
|
||||
y2 + Math.random() * entity.getHeight(),
|
||||
z2 + Math.random() * entity.getWidth(),
|
||||
0.5F, 0.5F, 0.5F, 1F, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ public class SubTileDandelifeon extends TileEntityGeneratingFlower {
|
||||
//world.setBlockToAir(x, y, z);
|
||||
} else if(blockAt == ModBlocks.cellBlock) {
|
||||
if(gen < 0)
|
||||
world.removeBlock(pos);
|
||||
world.removeBlock(pos, false);
|
||||
else ((TileCell) tile).setGeneration(this, gen);
|
||||
} else if(gen >= 0 && blockAt.isAir(stateAt, getWorld(), pos)) {
|
||||
world.setBlockState(pos, ModBlocks.cellBlock.getDefaultState());
|
||||
|
||||
@@ -14,10 +14,12 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.AbstractFurnaceTileEntity;
|
||||
import net.minecraft.tileentity.FurnaceTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
@@ -74,7 +76,7 @@ public class SubTileEndoflame extends TileEntityGeneratingFlower {
|
||||
if(stack.isEmpty() || stack.getItem().hasContainerItem(stack))
|
||||
continue;
|
||||
|
||||
int burnTime = Block.getBlockFromItem(stack.getItem()) instanceof BlockSpreader ? 0 : FurnaceTileEntity.getItemBurnTime(stack);
|
||||
int burnTime = getBurnTime(stack);
|
||||
if(burnTime > 0 && stack.getCount() > 0) {
|
||||
this.burnTime = Math.min(FUEL_CAP, burnTime) / 2;
|
||||
|
||||
@@ -155,4 +157,15 @@ public class SubTileEndoflame extends TileEntityGeneratingFlower {
|
||||
return 2;
|
||||
}
|
||||
|
||||
private int getBurnTime(ItemStack stack) {
|
||||
if (stack.isEmpty() || Block.getBlockFromItem(stack.getItem()) instanceof BlockSpreader) {
|
||||
return 0;
|
||||
} else {
|
||||
Item item = stack.getItem();
|
||||
int ret = stack.getBurnTime();
|
||||
return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(stack, ret == -1
|
||||
? AbstractFurnaceTileEntity.getBurnTimes().getOrDefault(item, 0) : ret);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -90,7 +90,7 @@ public class SubTileGourmaryllis extends TileEntityGeneratingFlower {
|
||||
for(ItemEntity item : items) {
|
||||
ItemStack stack = item.getItem();
|
||||
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemFood && !item.removed && item.age >= slowdown) {
|
||||
if(!stack.isEmpty() && stack.getItem().isFood() && !item.removed && item.age >= slowdown) {
|
||||
if(cooldown <= 0) {
|
||||
if(ItemHandlerHelper.canItemStacksStack(lastFood, stack)) {
|
||||
lastFoodCount++;
|
||||
@@ -100,7 +100,7 @@ public class SubTileGourmaryllis extends TileEntityGeneratingFlower {
|
||||
lastFoodCount = 1;
|
||||
}
|
||||
|
||||
int val = Math.min(12, ((ItemFood) stack.getItem()).getHealAmount(stack));
|
||||
int val = Math.min(12, stack.getItem().getFood().getHealing();
|
||||
digestingMana = val * val * 70;
|
||||
digestingMana *= 1F / lastFoodCount;
|
||||
cooldown = val * 10;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SubTileKekimurus extends TileEntityGeneratingFlower {
|
||||
if(block instanceof CakeBlock) {
|
||||
int nextSlicesEaten = state.get(CakeBlock.BITES) + 1;
|
||||
if(nextSlicesEaten > 6)
|
||||
getWorld().removeBlock(pos);
|
||||
getWorld().removeBlock(pos, false);
|
||||
else getWorld().setBlockState(pos, state.with(CakeBlock.BITES, nextSlicesEaten), 1 | 2);
|
||||
|
||||
getWorld().playEvent(2001, pos, Block.getStateId(state));
|
||||
|
||||
@@ -74,11 +74,12 @@ public class SubTileMunchdew extends TileEntityGeneratingFlower {
|
||||
BlockPos pos = getPos();
|
||||
|
||||
nextCoord:
|
||||
for(BlockPos pos_ : BlockPos.getAllInBox(pos.add(-RANGE, 0, -RANGE), pos.add(RANGE, RANGE_Y, RANGE))) {
|
||||
for(BlockPos pos_ : BlockPos.getAllInBoxMutable(pos.add(-RANGE, 0, -RANGE),
|
||||
pos.add(RANGE, RANGE_Y, RANGE))) {
|
||||
if(getWorld().getBlockState(pos_).getBlock().isIn(BlockTags.LEAVES)) {
|
||||
for(Direction dir : Direction.values()) {
|
||||
if(getWorld().isAirBlock(pos_.offset(dir))) {
|
||||
coords.add(pos_);
|
||||
coords.add(pos_.toImmutable());
|
||||
break nextCoord;
|
||||
}
|
||||
}
|
||||
@@ -91,7 +92,7 @@ public class SubTileMunchdew extends TileEntityGeneratingFlower {
|
||||
Collections.shuffle(coords);
|
||||
BlockPos breakCoords = coords.get(0);
|
||||
BlockState state = getWorld().getBlockState(breakCoords);
|
||||
getWorld().removeBlock(breakCoords);
|
||||
getWorld().removeBlock(breakCoords, false);
|
||||
ticksWithoutEating = 0;
|
||||
ateOnce = true;
|
||||
if(ConfigHandler.COMMON.blockBreakParticles.get())
|
||||
|
||||
+10
-4
@@ -14,6 +14,7 @@ import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
@@ -43,16 +44,17 @@ public class SubTileShulkMeNot extends TileEntityGeneratingFlower {
|
||||
|
||||
World world = getWorld();
|
||||
BlockPos pos = getPos();
|
||||
Vec3d posD = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
|
||||
List<ShulkerEntity> shulkers = world.getEntitiesWithinAABB(ShulkerEntity.class, new AxisAlignedBB(pos).grow(RADIUS));
|
||||
if(!world.isRemote)
|
||||
for(ShulkerEntity shulker : shulkers) {
|
||||
if(getMaxMana() - mana < generate)
|
||||
break;
|
||||
|
||||
if(shulker.isAlive() && shulker.getDistanceSq(pos) < RADIUS * RADIUS) {
|
||||
|
||||
if(shulker.isAlive() && shulker.getDistanceSq(posD) < RADIUS * RADIUS) {
|
||||
LivingEntity target = shulker.getAttackTarget();
|
||||
if(target != null && target instanceof IMob && target.isAlive()
|
||||
&& target.getDistanceSq(pos) < RADIUS * RADIUS && target.getActivePotionEffect(Effects.LEVITATION) != null) {
|
||||
&& target.getDistanceSq(posD) < RADIUS * RADIUS && target.getActivePotionEffect(Effects.LEVITATION) != null) {
|
||||
target.remove();
|
||||
shulker.remove();
|
||||
|
||||
@@ -71,7 +73,11 @@ public class SubTileShulkMeNot extends TileEntityGeneratingFlower {
|
||||
private void particles(World world, BlockPos pos, Entity entity) {
|
||||
if(world instanceof ServerWorld) {
|
||||
ServerWorld ws = (ServerWorld) world;
|
||||
ws.spawnParticle(ParticleTypes.EXPLOSION, entity.posX + entity.width / 2, entity.posY + entity.height / 2, entity.posZ + entity.width / 2, 100, entity.width, entity.height, entity.width, 0.05);
|
||||
ws.spawnParticle(ParticleTypes.EXPLOSION,
|
||||
entity.posX + entity.getWidth() / 2,
|
||||
entity.posY + entity.getHeight() / 2,
|
||||
entity.posZ + entity.getWidth() / 2,
|
||||
100, entity.getWidth(), entity.getHeight(), entity.getWidth(), 0.05);
|
||||
ws.spawnParticle(ParticleTypes.PORTAL, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 40, 0, 0, 0, 0.6);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user