mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 12:19:46 +00:00
Fix 'break and replace' exploits for gourmaryllis and spectrolus. Migrate all previous NBT-saving to vanilla's BlockEntityTag and loot tables
This commit is contained in:
1 parent
691e788473
commit
bda4cc70b6
17 files changed
+233
-84
No files matched your search
@@ -48,7 +48,7 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
|
||||
private static final String TAG_COLLECTOR_X = "collectorX";
|
||||
private static final String TAG_COLLECTOR_Y = "collectorY";
|
||||
private static final String TAG_COLLECTOR_Z = "collectorZ";
|
||||
private static final String TAG_PASSIVE_DECAY_TICKS = "passiveDecayTicks";
|
||||
public static final String TAG_PASSIVE_DECAY_TICKS = "passiveDecayTicks";
|
||||
|
||||
private int mana;
|
||||
|
||||
@@ -196,31 +196,6 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(List<ItemStack> list, LootContext.Builder ctx) {
|
||||
List<ItemStack> drops = super.getDrops(list, ctx);
|
||||
populateDropStackNBTs(drops);
|
||||
return drops;
|
||||
}
|
||||
|
||||
public void populateDropStackNBTs(List<ItemStack> drops) {
|
||||
if(isPassiveFlower() && ticksExisted > 0 && BotaniaAPI.internalHandler.getPassiveFlowerDecay() > 0) {
|
||||
ItemStack drop = drops.get(0);
|
||||
if(!drop.isEmpty()) {
|
||||
drop.getOrCreateTag().putInt(TAG_PASSIVE_DECAY_TICKS, passiveDecayTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||
if(isPassiveFlower()) {
|
||||
CompoundNBT cmp = stack.getOrCreateTag();
|
||||
passiveDecayTicks = cmp.getInt(TAG_PASSIVE_DECAY_TICKS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onWanded(PlayerEntity player, ItemStack wand) {
|
||||
if(player == null)
|
||||
|
||||
Reference in new issue
Block a user