Regenerate patches with relative headers. This should lower conflicts in future PRs.

Convert Forge to use Official mappings.
Mojang released their obfuscation mappings but we have not used them up until now due to wanting to get their license to be more explicitly permissive.
It is clear that their intent is to allow us to use their names for developing mods like this.
See the full wording, and our interpretation here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
This commit is contained in:
LexManos committed 2021-03-09 14:21:48 -08:00
1 parent 802298d99d
commit a95b968c13
832 files changed
+4464 -4373

No files matched your search

@@ -69,14 +69,14 @@ public class CustomPlantTypeTest
{
public CustomBlock()
{
super(Block.Properties.create(Material.ROCK));
super(Block.Properties.of(Material.STONE));
this.setRegistryName(MODID, CUSTOM_SOIL_BLOCK);
}
@Override
public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable)
{
PlantType type = plantable.getPlantType(world, pos.offset(facing));
PlantType type = plantable.getPlantType(world, pos.relative(facing));
if (type != null && type == CustomPlantBlock.pt)
{
return true;
@@ -91,7 +91,7 @@ public class CustomPlantTypeTest
public CustomPlantBlock()
{
super(Effects.WEAKNESS, 9, Block.Properties.create(Material.PLANTS).doesNotBlockMovement().sound(SoundType.PLANT));
super(Effects.WEAKNESS, 9, Block.Properties.of(Material.PLANT).noCollission().sound(SoundType.GRASS));
this.setRegistryName(MODID, CUSTOM_PLANT_BLOCK);
}
@@ -104,18 +104,18 @@ public class CustomPlantTypeTest
@Override
public BlockState getPlant(IBlockReader world, BlockPos pos)
{
return getDefaultState();
return defaultBlockState();
}
@Override
public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos)
public boolean canSurvive(BlockState state, IWorldReader world, BlockPos pos)
{
BlockState soil = world.getBlockState(pos.down());
BlockState soil = world.getBlockState(pos.below());
return soil.canSustainPlant(world, pos, Direction.UP, this);
}
@Override
public boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos)
public boolean mayPlaceOn(BlockState state, IBlockReader worldIn, BlockPos pos)
{
Block block = state.getBlock();
return block == CUSTOM_SOIL;
@@ -44,9 +44,9 @@ public class FlowerPotTest
private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
public static final RegistryObject<FlowerPotBlock> EMPTY_FLOWER_POT = BLOCKS.register(BLOCK_ID, () -> new FlowerPotBlock(null, Blocks.AIR.delegate, Block.Properties.from(Blocks.FLOWER_POT)));
public static final RegistryObject<FlowerPotBlock> EMPTY_FLOWER_POT = BLOCKS.register(BLOCK_ID, () -> new FlowerPotBlock(null, Blocks.AIR.delegate, Block.Properties.copy(Blocks.FLOWER_POT)));
public static final RegistryObject<FlowerPotBlock> OAK_FLOWER_POT = BLOCKS.<FlowerPotBlock>register(
BLOCK_ID + "_oak", () -> new FlowerPotBlock(EMPTY_FLOWER_POT, Blocks.OAK_SAPLING.delegate, Block.Properties.from(Blocks.FLOWER_POT)));
BLOCK_ID + "_oak", () -> new FlowerPotBlock(EMPTY_FLOWER_POT, Blocks.OAK_SAPLING.delegate, Block.Properties.copy(Blocks.FLOWER_POT)));
static {
ITEMS.register(BLOCK_ID, () -> new BlockItem(EMPTY_FLOWER_POT.get(), new Item.Properties()));
@@ -36,9 +36,9 @@ public class HarvestToolTest
{
PlayerEntity player = event.getPlayer();
BlockState state = event.getState();
for (ToolType toolType : player.getHeldItemMainhand().getToolTypes()) {
for (ToolType toolType : player.getMainHandItem().getToolTypes()) {
if (state.isToolEffective(toolType)) {
player.sendMessage(new StringTextComponent(String.format("Tool was effective. tool type: %s | harvest level: %d", toolType.getName(), state.getHarvestLevel())), player.getUniqueID());
player.sendMessage(new StringTextComponent(String.format("Tool was effective. tool type: %s | harvest level: %d", toolType.getName(), state.getHarvestLevel())), player.getUUID());
break;
}
}
@@ -68,9 +68,9 @@ public class PistonEventTest
private static DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
private static DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
private static RegistryObject<Block> shiftOnMove = BLOCKS.register(blockName, () -> new Block(Block.Properties.create(Material.ROCK)));
private static RegistryObject<Block> shiftOnMove = BLOCKS.register(blockName, () -> new Block(Block.Properties.of(Material.STONE)));
static {
ITEMS.register(blockName, () -> new BlockItem(shiftOnMove.get(), new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)));
ITEMS.register(blockName, () -> new BlockItem(shiftOnMove.get(), new Item.Properties().tab(ItemGroup.TAB_BUILDING_BLOCKS)));
}
public PistonEventTest()
@@ -89,28 +89,28 @@ public class PistonEventTest
World world = (World) event.getWorld();
PistonBlockStructureHelper pistonHelper = event.getStructureHelper();
PlayerEntity player = DistExecutor.safeCallWhenOn(Dist.CLIENT, () -> () -> Minecraft.getInstance().player);
if (world.isRemote && player != null)
if (world.isClientSide && player != null)
{
if (pistonHelper.canMove())
if (pistonHelper.resolve())
{
player.sendMessage(new StringTextComponent(String.format("Piston will extend moving %d blocks and destroy %d blocks", pistonHelper.getBlocksToMove().size(), pistonHelper.getBlocksToDestroy().size())), player.getUniqueID());
player.sendMessage(new StringTextComponent(String.format("Piston will extend moving %d blocks and destroy %d blocks", pistonHelper.getToPush().size(), pistonHelper.getToDestroy().size())), player.getUUID());
}
else
{
player.sendMessage(new StringTextComponent("Piston won't extend"), player.getUniqueID());
player.sendMessage(new StringTextComponent("Piston won't extend"), player.getUUID());
}
}
if (pistonHelper.canMove())
if (pistonHelper.resolve())
{
List<BlockPos> posList = pistonHelper.getBlocksToMove();
List<BlockPos> posList = pistonHelper.getToPush();
for (BlockPos newPos : posList)
{
BlockState state = event.getWorld().getBlockState(newPos);
if (state.getBlock() == Blocks.BLACK_WOOL)
{
Block.spawnDrops(state, world, newPos);
world.setBlockState(newPos, Blocks.AIR.getDefaultState());
Block.dropResources(state, world, newPos);
world.setBlockAndUpdate(newPos, Blocks.AIR.defaultBlockState());
}
}
}
@@ -119,8 +119,8 @@ public class PistonEventTest
BlockPos pushedBlockPos = event.getFaceOffsetPos();
if (world.getBlockState(pushedBlockPos).getBlock() == shiftOnMove.get() && event.getDirection() != Direction.DOWN)
{
world.setBlockState(pushedBlockPos, Blocks.AIR.getDefaultState());
world.setBlockState(pushedBlockPos.up(), shiftOnMove.get().getDefaultState());
world.setBlockAndUpdate(pushedBlockPos, Blocks.AIR.defaultBlockState());
world.setBlockAndUpdate(pushedBlockPos.above(), shiftOnMove.get().defaultBlockState());
}
// Block pushing cobblestone (directly, indirectly works)
@@ -131,22 +131,22 @@ public class PistonEventTest
boolean isSticky = event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.STICKY_PISTON;
PlayerEntity player = DistExecutor.safeCallWhenOn(Dist.CLIENT, () -> () -> Minecraft.getInstance().player);
if (event.getWorld().isRemote() && player != null)
if (event.getWorld().isClientSide() && player != null)
{
if (isSticky)
{
BlockPos targetPos = event.getFaceOffsetPos().offset(event.getDirection());
boolean canPush = PistonBlock.canPush(event.getWorld().getBlockState(targetPos), (World) event.getWorld(), event.getFaceOffsetPos(), event.getDirection().getOpposite(), false, event.getDirection());
boolean isAir = event.getWorld().isAirBlock(targetPos);
player.sendMessage(new StringTextComponent(String.format("Piston will retract moving %d blocks", !isAir && canPush ? 1 : 0)), player.getUniqueID());
BlockPos targetPos = event.getFaceOffsetPos().relative(event.getDirection());
boolean canPush = PistonBlock.isPushable(event.getWorld().getBlockState(targetPos), (World) event.getWorld(), event.getFaceOffsetPos(), event.getDirection().getOpposite(), false, event.getDirection());
boolean isAir = event.getWorld().isEmptyBlock(targetPos);
player.sendMessage(new StringTextComponent(String.format("Piston will retract moving %d blocks", !isAir && canPush ? 1 : 0)), player.getUUID());
}
else
{
player.sendMessage(new StringTextComponent("Piston will retract"), player.getUniqueID());
player.sendMessage(new StringTextComponent("Piston will retract"), player.getUUID());
}
}
// Offset twice to see if retraction will pull cobblestone
event.setCanceled(event.getWorld().getBlockState(event.getFaceOffsetPos().offset(event.getDirection())).getBlock() == Blocks.COBBLESTONE && isSticky);
event.setCanceled(event.getWorld().getBlockState(event.getFaceOffsetPos().relative(event.getDirection())).getBlock() == Blocks.COBBLESTONE && isSticky);
}
}
@@ -45,6 +45,8 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraft.block.AbstractBlock.Properties;
/**
* This test mod allows a custom scaffolding to move down
* while sneaking through a method.
@@ -56,7 +58,7 @@ public class ScaffoldingTest
static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
static final IOptionalNamedTag<Block> SCAFFOLDING = BlockTags.createOptional(new ResourceLocation("forge", "scaffolding"));
static final RegistryObject<Block> SCAFFOLDING_METHOD_TEST = BLOCKS.register("scaffolding_method_test", () -> new ScaffoldingMethodTestBlock(AbstractBlock.Properties.create(Material.MISCELLANEOUS, MaterialColor.SAND).doesNotBlockMovement().sound(SoundType.SCAFFOLDING).variableOpacity()));
static final RegistryObject<Block> SCAFFOLDING_METHOD_TEST = BLOCKS.register("scaffolding_method_test", () -> new ScaffoldingMethodTestBlock(AbstractBlock.Properties.of(Material.DECORATION, MaterialColor.SAND).noCollission().sound(SoundType.SCAFFOLDING).dynamicShape()));
public ScaffoldingTest()
{
@@ -81,7 +83,7 @@ public class ScaffoldingTest
@Override
protected void registerStatesAndModels()
{
this.getVariantBuilder(SCAFFOLDING_METHOD_TEST.get()).forAllStatesExcept((state) -> ConfiguredModel.builder().modelFile(state.get(ScaffoldingBlock.BOTTOM) ? new ModelFile.ExistingModelFile(new ResourceLocation("block/scaffolding_unstable"), this.models().existingFileHelper) : new ModelFile.ExistingModelFile(new ResourceLocation("block/scaffolding_stable"), this.models().existingFileHelper)).build(), ScaffoldingBlock.DISTANCE, ScaffoldingBlock.WATERLOGGED);
this.getVariantBuilder(SCAFFOLDING_METHOD_TEST.get()).forAllStatesExcept((state) -> ConfiguredModel.builder().modelFile(state.getValue(ScaffoldingBlock.BOTTOM) ? new ModelFile.ExistingModelFile(new ResourceLocation("block/scaffolding_unstable"), this.models().existingFileHelper) : new ModelFile.ExistingModelFile(new ResourceLocation("block/scaffolding_stable"), this.models().existingFileHelper)).build(), ScaffoldingBlock.DISTANCE, ScaffoldingBlock.WATERLOGGED);
}
}
@@ -47,7 +47,7 @@ public class SlipperinessTest
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> e)
{
e.getRegistry().register((new Block(Block.Properties.create(Material.PACKED_ICE))
e.getRegistry().register((new Block(Block.Properties.of(Material.ICE_SOLID))
{
@Override
public float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, Entity entity)
@@ -43,7 +43,7 @@ public class StickyBlockTest
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event)
{
event.getRegistry().register((new Block(Block.Properties.create(Material.ROCK))
event.getRegistry().register((new Block(Block.Properties.of(Material.STONE))
{
@Override
public boolean isStickyBlock(BlockState state)