1.15 pre1
This commit is contained in:
1 parent
193b7a3e3a
commit
8ecaac80e2
2 files changed
+39
-7
No files matched your search
+3
-3
@@ -4,9 +4,9 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
# or better: https://modmuss50.me/fabric.html
|
# or better: https://modmuss50.me/fabric.html
|
||||||
minecraft_version=19w46b
|
minecraft_version=1.15-pre1
|
||||||
yarn_mappings=19w46b+build.8
|
yarn_mappings=1.15-pre1+build.3
|
||||||
loader_version=0.7.0+build.171
|
loader_version=0.7.1+build.173
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.2.4+v191121
|
mod_version = 1.2.4+v191121
|
||||||
|
|||||||
@@ -9,10 +9,13 @@ import java.util.List;
|
|||||||
import carpet.mixins.ExplosionAccessor;
|
import carpet.mixins.ExplosionAccessor;
|
||||||
import carpet.settings.CarpetSettings;
|
import carpet.settings.CarpetSettings;
|
||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import it.unimi.dsi.fastutil.objects.*;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.entity.TntEntity;
|
import net.minecraft.entity.TntEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.fluid.FluidState;
|
import net.minecraft.fluid.FluidState;
|
||||||
@@ -27,9 +30,6 @@ import net.minecraft.loot.context.LootContextParameters;
|
|||||||
import org.apache.commons.lang3.tuple.MutablePair;
|
import org.apache.commons.lang3.tuple.MutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap;
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.enchantment.ProtectionEnchantment;
|
import net.minecraft.enchantment.ProtectionEnchantment;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@@ -200,6 +200,9 @@ public class OptimizedExplosion
|
|||||||
|
|
||||||
if (damagesTerrain)
|
if (damagesTerrain)
|
||||||
{
|
{
|
||||||
|
ObjectArrayList<ItemStack> objectArrayList = new ObjectArrayList<>();
|
||||||
|
List<BlockPos> list = Lists.newArrayList();
|
||||||
|
|
||||||
for (BlockPos blockpos : e.getAffectedBlocks())
|
for (BlockPos blockpos : e.getAffectedBlocks())
|
||||||
{
|
{
|
||||||
BlockState state = world.getBlockState(blockpos);
|
BlockState state = world.getBlockState(blockpos);
|
||||||
@@ -231,6 +234,8 @@ public class OptimizedExplosion
|
|||||||
{
|
{
|
||||||
if (block.shouldDropItemsOnExplosion(e))
|
if (block.shouldDropItemsOnExplosion(e))
|
||||||
{
|
{
|
||||||
|
list.add(blockpos.toImmutable());
|
||||||
|
|
||||||
BlockEntity blockEntity = block.hasBlockEntity() ? world.getBlockEntity(blockpos) : null;
|
BlockEntity blockEntity = block.hasBlockEntity() ? world.getBlockEntity(blockpos) : null;
|
||||||
|
|
||||||
LootContext.Builder lootBuilder = new LootContext.Builder((ServerWorld) eAccess.getWorld())
|
LootContext.Builder lootBuilder = new LootContext.Builder((ServerWorld) eAccess.getWorld())
|
||||||
@@ -242,13 +247,21 @@ public class OptimizedExplosion
|
|||||||
if (eAccess.getBlockDestructionType() == Explosion.DestructionType.DESTROY)
|
if (eAccess.getBlockDestructionType() == Explosion.DestructionType.DESTROY)
|
||||||
lootBuilder.put(LootContextParameters.EXPLOSION_RADIUS, eAccess.getPower());
|
lootBuilder.put(LootContextParameters.EXPLOSION_RADIUS, eAccess.getPower());
|
||||||
|
|
||||||
Block.dropStacks(state, lootBuilder);
|
state.getDroppedStacks(lootBuilder).forEach((itemStackx) -> {
|
||||||
|
method_24023(objectArrayList, itemStackx);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
world.setBlockState(blockpos, Blocks.AIR.getDefaultState(), 3);
|
world.setBlockState(blockpos, Blocks.AIR.getDefaultState(), 3);
|
||||||
block.onDestroyedByExplosion(world, blockpos, e);
|
block.onDestroyedByExplosion(world, blockpos, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int i = list.size();
|
||||||
|
|
||||||
|
for (ItemStack itemStack : objectArrayList)
|
||||||
|
{
|
||||||
|
Block.dropStack(world, list.get(world.random.nextInt(i)), itemStack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eAccess.isCreateFire())
|
if (eAccess.isCreateFire())
|
||||||
@@ -269,6 +282,25 @@ public class OptimizedExplosion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copied from Explosion, need to move the code to the explosion code anyways and use shadows for
|
||||||
|
// simplicity, its not jarmodding anyways
|
||||||
|
private static void method_24023(ObjectArrayList<ItemStack> objectArrayList, ItemStack itemStack) {
|
||||||
|
int i = objectArrayList.size();
|
||||||
|
|
||||||
|
for(int j = 0; j < i; ++j) {
|
||||||
|
ItemStack itemStack2 = (ItemStack)objectArrayList.get(j);
|
||||||
|
if (ItemEntity.method_24017(itemStack2, itemStack)) {
|
||||||
|
ItemStack itemStack3 = ItemEntity.method_24018(itemStack2, itemStack, 16);
|
||||||
|
objectArrayList.set(j, itemStack3);
|
||||||
|
if (itemStack.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
objectArrayList.add(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
private static void removeFast(List<Entity> lst, int index) {
|
private static void removeFast(List<Entity> lst, int index) {
|
||||||
if (index < lst.size() - 1)
|
if (index < lst.size() - 1)
|
||||||
lst.set(index, lst.get(lst.size() - 1));
|
lst.set(index, lst.get(lst.size() - 1));
|
||||||
|
|||||||
Reference in new issue
Block a user