diff --git a/build.gradle b/build.gradle index b51c3ced6..0a246d3fa 100644 --- a/build.gradle +++ b/build.gradle @@ -69,12 +69,12 @@ license { group = 'TechReborn' dependencies { - minecraft "com.mojang:minecraft:19w34a" - mappings "net.fabricmc:yarn:19w34a+build.12" + minecraft "com.mojang:minecraft:19w37a" + mappings "net.fabricmc:yarn:19w37a+build.9" modCompile "net.fabricmc:fabric-loader:0.6.0+build.163" //Fabric api - modCompile "net.fabricmc.fabric-api:fabric-api:0.3.2+build.212-1.15" + modCompile "net.fabricmc.fabric-api:fabric-api:0.3.2+build.227-1.15" modCompile "io.github.prospector:modmenu:1.7.9-unstable.19w34a+build.1" modCompile "io.github.prospector.silk:SilkAPI:1.2.4-43" @@ -93,7 +93,7 @@ dependencies { compile 'org.checkerframework:checker-qual:2.10.0' compileOnly "com.google.code.findbugs:jsr305:+" - modCompile ('com.github.Virtuoel:Towelette:519538e54b') { + modCompileOnly ('com.github.Virtuoel:Towelette:519538e54b') { transitive = false } } diff --git a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java index ff994704d..a94f89c5a 100644 --- a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java @@ -83,7 +83,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I return; } if (world.getTime() % 20 == 0) { - canSeeSky = world.method_8626(pos.up()); + canSeeSky = world.isSkyVisible(pos.up()); if (lastState != isSunOut()) { world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, isSunOut())); lastState = isSunOut(); diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/VacuumFreezerBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/VacuumFreezerBlockEntity.java index 26d5d7ab7..7aa4954dd 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/VacuumFreezerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/VacuumFreezerBlockEntity.java @@ -69,8 +69,8 @@ public class VacuumFreezerBlockEntity extends GenericMachineBlockEntity implemen // BlockEntity @Override - public void validate() { - super.validate(); + public void cancelRemoval() { + super.cancelRemoval(); multiblockChecker = new MultiblockChecker(world, pos.down()); } diff --git a/src/main/java/techreborn/blocks/misc/BlockRubberLog.java b/src/main/java/techreborn/blocks/misc/BlockRubberLog.java index 9a316e4c0..171e92b01 100644 --- a/src/main/java/techreborn/blocks/misc/BlockRubberLog.java +++ b/src/main/java/techreborn/blocks/misc/BlockRubberLog.java @@ -29,6 +29,7 @@ import net.minecraft.block.*; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundCategory; import net.minecraft.state.StateFactory; @@ -82,12 +83,12 @@ public class BlockRubberLog extends LogBlock { public void onBreak(World worldIn, BlockPos pos, BlockState state, PlayerEntity player) { int i = 4; int j = i + 1; - if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) { + if (worldIn instanceof ServerWorld && worldIn.isRegionLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) { for (BlockPos blockpos : BlockPos.iterate(pos.add(-i, -i, -i), pos.add(i, i, i))) { BlockState state1 = worldIn.getBlockState(blockpos); if (state1.matches(BlockTags.LEAVES)) { - state1.scheduledTick(worldIn, blockpos, worldIn.getRandom()); - state1.onRandomTick(worldIn, blockpos, worldIn.getRandom()); + state1.scheduledTick((ServerWorld) worldIn, blockpos, worldIn.getRandom()); + state1.onRandomTick((ServerWorld) worldIn, blockpos, worldIn.getRandom()); } } } @@ -95,7 +96,7 @@ public class BlockRubberLog extends LogBlock { } @Override - public void onScheduledTick(BlockState state, World worldIn, BlockPos pos, Random random) { + public void onScheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { super.onScheduledTick(state, worldIn, pos, random); if (state.get(AXIS) != Direction.Axis.Y) { return; diff --git a/src/main/java/techreborn/client/render/DynamicBucketBakedModel.java b/src/main/java/techreborn/client/render/DynamicBucketBakedModel.java index 0245791a8..5cc58805c 100644 --- a/src/main/java/techreborn/client/render/DynamicBucketBakedModel.java +++ b/src/main/java/techreborn/client/render/DynamicBucketBakedModel.java @@ -46,7 +46,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.world.ExtendedBlockView; +import net.minecraft.world.BlockRenderView; import reborncore.common.fluid.container.ItemFluidInfo; import reborncore.common.util.Color; import techreborn.TechReborn; @@ -70,7 +70,7 @@ public class DynamicBucketBakedModel implements BakedModel, FabricBakedModel { } @Override - public void emitBlockQuads(ExtendedBlockView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { + public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { } diff --git a/src/main/java/techreborn/client/render/DynamicCellBakedModel.java b/src/main/java/techreborn/client/render/DynamicCellBakedModel.java index 0cc66e492..a7e1aa233 100644 --- a/src/main/java/techreborn/client/render/DynamicCellBakedModel.java +++ b/src/main/java/techreborn/client/render/DynamicCellBakedModel.java @@ -46,7 +46,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.world.ExtendedBlockView; +import net.minecraft.world.BlockRenderView; import reborncore.common.fluid.container.ItemFluidInfo; import reborncore.common.util.Color; import techreborn.TechReborn; @@ -65,7 +65,7 @@ public class DynamicCellBakedModel implements BakedModel, FabricBakedModel { private static final ModelIdentifier CELL_GLASS = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory"); @Override - public void emitBlockQuads(ExtendedBlockView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { + public void emitBlockQuads(BlockRenderView blockRenderView, BlockState blockState, BlockPos blockPos, Supplier supplier, RenderContext renderContext) { } diff --git a/src/main/java/techreborn/items/ItemFrequencyTransmitter.java b/src/main/java/techreborn/items/ItemFrequencyTransmitter.java index af9d2e39e..d5908105e 100644 --- a/src/main/java/techreborn/items/ItemFrequencyTransmitter.java +++ b/src/main/java/techreborn/items/ItemFrequencyTransmitter.java @@ -109,7 +109,7 @@ public class ItemFrequencyTransmitter extends Item { } } - return new TypedActionResult<>(ActionResult.SUCCESS, stack); + return new TypedActionResult<>(ActionResult.SUCCESS, stack, true); } @Environment(EnvType.CLIENT) diff --git a/src/main/java/techreborn/items/ItemManual.java b/src/main/java/techreborn/items/ItemManual.java index ef9fd4a2e..090caac8c 100644 --- a/src/main/java/techreborn/items/ItemManual.java +++ b/src/main/java/techreborn/items/ItemManual.java @@ -49,7 +49,7 @@ public class ItemManual extends Item { if(world.isClient){ openGui(player); } - return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand)); + return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand), true); } @Environment(EnvType.CLIENT) diff --git a/src/main/java/techreborn/items/ItemScrapBox.java b/src/main/java/techreborn/items/ItemScrapBox.java index 45822c266..97040453c 100644 --- a/src/main/java/techreborn/items/ItemScrapBox.java +++ b/src/main/java/techreborn/items/ItemScrapBox.java @@ -54,6 +54,6 @@ public class ItemScrapBox extends Item { WorldUtils.dropItem(out, world, player.getBlockPos()); stack.decrement(1); } - return new TypedActionResult<>(ActionResult.SUCCESS, stack); + return new TypedActionResult<>(ActionResult.SUCCESS, stack, true); } } diff --git a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java b/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java index a98db1e41..59ac4e3fd 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java +++ b/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java @@ -141,9 +141,9 @@ public class ItemIndustrialChainsaw extends ItemChainsaw { } } } - return new TypedActionResult<>(ActionResult.SUCCESS, stack); + return new TypedActionResult<>(ActionResult.SUCCESS, stack, true); } - return new TypedActionResult<>(ActionResult.PASS, stack); + return new TypedActionResult<>(ActionResult.PASS, stack, true); } @Override diff --git a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java b/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java index 7dd174b3c..53ec6878f 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java +++ b/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java @@ -200,9 +200,9 @@ public class ItemIndustrialDrill extends ItemDrill { } } } - return new TypedActionResult<>(ActionResult.SUCCESS, stack); + return new TypedActionResult<>(ActionResult.SUCCESS, stack, true); } - return new TypedActionResult<>(ActionResult.PASS, stack); + return new TypedActionResult<>(ActionResult.PASS, stack, true); } @Override diff --git a/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java b/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java index 694788e0e..53dcdd850 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java +++ b/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java @@ -138,9 +138,9 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur } } } - return new TypedActionResult<>(ActionResult.SUCCESS, stack); + return new TypedActionResult<>(ActionResult.SUCCESS, stack, true); } - return new TypedActionResult<>(ActionResult.PASS, stack); + return new TypedActionResult<>(ActionResult.PASS, stack, true); } @Override diff --git a/src/main/java/techreborn/world/RubberTreeFeature.java b/src/main/java/techreborn/world/RubberTreeFeature.java index af68f0802..3a0dd3f58 100644 --- a/src/main/java/techreborn/world/RubberTreeFeature.java +++ b/src/main/java/techreborn/world/RubberTreeFeature.java @@ -1,145 +1,145 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.world; - -import java.util.Random; -import java.util.Set; -import java.util.function.Function; - -import com.mojang.datafixers.Dynamic; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MutableIntBoundingBox; -import net.minecraft.world.ModifiableTestableWorld; -import net.minecraft.world.gen.feature.AbstractTreeFeature; -import net.minecraft.world.gen.feature.DefaultFeatureConfig; -import techreborn.blocks.misc.BlockRubberLog; -import techreborn.init.TRContent; - -/** - * @author drcrazy - * - */ -public class RubberTreeFeature extends AbstractTreeFeature { - - // TODO: Configs - private int treeBaseHeight = 5; - private int sapRarity = 10; - private int spireHeight = 4; - - - public RubberTreeFeature(Function, ? extends DefaultFeatureConfig> featureConfig, boolean notify) { - super(featureConfig, notify); - } - - @Override - protected boolean generate(Set changedBlocks, ModifiableTestableWorld worldIn, Random rand, - BlockPos saplingPos, MutableIntBoundingBox mutableBoundingBox) { - int treeHeight = rand.nextInt(5) + treeBaseHeight; - int baseY = saplingPos.getY(); - int baseX = saplingPos.getX(); - int baseZ = saplingPos.getZ(); - if (baseY <= 1 && baseY + treeHeight + spireHeight + 1 >= 256) { - return false; - } - - if (!isDirtOrGrass(worldIn, saplingPos.down())) { - return false; - } - - int yOffset; - int xOffset; - int zOffset; - for (yOffset = baseY; yOffset <= baseY + 1 + treeHeight; ++yOffset) { - byte radius = 1; - if (yOffset == baseY) { - radius = 0; - } - if (yOffset >= baseY + 1 + treeHeight - 2) { - radius = 2; - } - - BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); - for (xOffset = baseX - radius; xOffset <= baseX + radius; ++xOffset) { - for (zOffset = baseZ - radius; zOffset <= baseZ + radius; ++zOffset) { - if (!isAirOrLeaves(worldIn, blockpos$mutable.set(xOffset, yOffset, zOffset))) { - return false; - } - } - } - } - - // Ok, we are cleared for take off! - this.setToDirt(worldIn, saplingPos.down()); - - // Leaves - BlockState leafState = TRContent.RUBBER_LEAVES.getDefaultState(); - for (yOffset = baseY - 3 + treeHeight; yOffset <= baseY + treeHeight; ++yOffset) { - int var12 = yOffset - (baseY + treeHeight), center = 1 - var12 / 2; - for (xOffset = baseX - center; xOffset <= baseX + center; ++xOffset) { - int xPos = xOffset - baseX, t = xPos >> 15; - xPos = (xPos + t) ^ t; - for (zOffset = baseZ - center; zOffset <= baseZ + center; ++zOffset) { - int zPos = zOffset - baseZ; - zPos = (zPos + (t = zPos >> 31)) ^ t; - if ((xPos != center | zPos != center) || rand.nextInt(2) != 0 && var12 != 0) { - BlockPos leafPos = new BlockPos(xOffset, yOffset, zOffset); - if (isAirOrLeaves(worldIn, leafPos) || isReplaceablePlant(worldIn, leafPos)) { - this.setBlockState(changedBlocks, worldIn, leafPos, leafState, mutableBoundingBox); - } - } - } - } - } - - // Trunk - BlockPos currentLogPos = null; - BlockState logState = TRContent.RUBBER_LOG.getDefaultState(); - for (yOffset = 0; yOffset < treeHeight; ++yOffset) { - currentLogPos = saplingPos.up(yOffset); - if (!isAirOrLeaves(worldIn, currentLogPos)) { - continue; - } - if (rand.nextInt(sapRarity) == 0) { - logState = logState.with(BlockRubberLog.HAS_SAP, true).with(BlockRubberLog.SAP_SIDE, - Direction.fromHorizontal(rand.nextInt(4))); - } - this.setBlockState(changedBlocks, worldIn, currentLogPos, logState, mutableBoundingBox); - } - - // Spire - if (currentLogPos != null) { - for (int i = 0; i < spireHeight; i++) { - BlockPos blockpos = currentLogPos.up(i); - this.setBlockState(changedBlocks, worldIn, blockpos, leafState, mutableBoundingBox); - } - } - - return true; - } - -} +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2018 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.world; + +import java.util.Random; +import java.util.Set; +import java.util.function.Function; + +import com.mojang.datafixers.Dynamic; + +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockBox; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.ModifiableTestableWorld; +import net.minecraft.world.gen.feature.AbstractTreeFeature; +import net.minecraft.world.gen.feature.DefaultFeatureConfig; +import techreborn.blocks.misc.BlockRubberLog; +import techreborn.init.TRContent; + +/** + * @author drcrazy + * + */ +public class RubberTreeFeature extends AbstractTreeFeature { + + // TODO: Configs + private int treeBaseHeight = 5; + private int sapRarity = 10; + private int spireHeight = 4; + + + public RubberTreeFeature(Function, ? extends DefaultFeatureConfig> featureConfig, boolean notify) { + super(featureConfig, notify); + } + + @Override + protected boolean generate(Set changedBlocks, ModifiableTestableWorld worldIn, Random rand, + BlockPos saplingPos, BlockBox mutableBoundingBox) { + int treeHeight = rand.nextInt(5) + treeBaseHeight; + int baseY = saplingPos.getY(); + int baseX = saplingPos.getX(); + int baseZ = saplingPos.getZ(); + if (baseY <= 1 && baseY + treeHeight + spireHeight + 1 >= 256) { + return false; + } + + if (!isDirtOrGrass(worldIn, saplingPos.down())) { + return false; + } + + int yOffset; + int xOffset; + int zOffset; + for (yOffset = baseY; yOffset <= baseY + 1 + treeHeight; ++yOffset) { + byte radius = 1; + if (yOffset == baseY) { + radius = 0; + } + if (yOffset >= baseY + 1 + treeHeight - 2) { + radius = 2; + } + + BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); + for (xOffset = baseX - radius; xOffset <= baseX + radius; ++xOffset) { + for (zOffset = baseZ - radius; zOffset <= baseZ + radius; ++zOffset) { + if (!isAirOrLeaves(worldIn, blockpos$mutable.set(xOffset, yOffset, zOffset))) { + return false; + } + } + } + } + + // Ok, we are cleared for take off! + this.setToDirt(worldIn, saplingPos.down()); + + // Leaves + BlockState leafState = TRContent.RUBBER_LEAVES.getDefaultState(); + for (yOffset = baseY - 3 + treeHeight; yOffset <= baseY + treeHeight; ++yOffset) { + int var12 = yOffset - (baseY + treeHeight), center = 1 - var12 / 2; + for (xOffset = baseX - center; xOffset <= baseX + center; ++xOffset) { + int xPos = xOffset - baseX, t = xPos >> 15; + xPos = (xPos + t) ^ t; + for (zOffset = baseZ - center; zOffset <= baseZ + center; ++zOffset) { + int zPos = zOffset - baseZ; + zPos = (zPos + (t = zPos >> 31)) ^ t; + if ((xPos != center | zPos != center) || rand.nextInt(2) != 0 && var12 != 0) { + BlockPos leafPos = new BlockPos(xOffset, yOffset, zOffset); + if (isAirOrLeaves(worldIn, leafPos) || isReplaceablePlant(worldIn, leafPos)) { + this.setBlockState(changedBlocks, worldIn, leafPos, leafState, mutableBoundingBox); + } + } + } + } + } + + // Trunk + BlockPos currentLogPos = null; + BlockState logState = TRContent.RUBBER_LOG.getDefaultState(); + for (yOffset = 0; yOffset < treeHeight; ++yOffset) { + currentLogPos = saplingPos.up(yOffset); + if (!isAirOrLeaves(worldIn, currentLogPos)) { + continue; + } + if (rand.nextInt(sapRarity) == 0) { + logState = logState.with(BlockRubberLog.HAS_SAP, true).with(BlockRubberLog.SAP_SIDE, + Direction.fromHorizontal(rand.nextInt(4))); + } + this.setBlockState(changedBlocks, worldIn, currentLogPos, logState, mutableBoundingBox); + } + + // Spire + if (currentLogPos != null) { + for (int i = 0; i < spireHeight; i++) { + BlockPos blockpos = currentLogPos.up(i); + this.setBlockState(changedBlocks, worldIn, blockpos, leafState, mutableBoundingBox); + } + } + + return true; + } + +}