Merge branch 'master' into 1.17

# Conflicts:
#	src/main/java/carpet/script/utils/SnoopyCommandSource.java
#	src/main/java/carpet/utils/WoolTool.java
This commit is contained in:
gnembon committed 2021-05-18 21:23:15 -03:00
commit b80b555781
9 files changed
+147 -12

No files matched your search

+23
View File
@@ -18,10 +18,23 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* A series of utility functions and variables for dealing predominantly with hopper counters and determining which counter
* to add their items to, as well as helping dealing with carpet functionality.
*/
public class WoolTool
{
/**
* A map of the {@link MaterialColor} to the {@link DyeColor} which is used in {@link WoolTool#getWoolColorAtPosition}
* to get the colour of wool at a position.
*/
private static final HashMap<MapColor,DyeColor> Material2Dye = new HashMap<>();
/**
* A map of all the wool colours to their respective colours in the {@link Messenger#m} format so the name of the counter
* gets printed in colour.
*/
public static final HashMap<MapColor,String> Material2DyeName = new HashMap<MapColor, String>(){{
put(MapColor.WHITE, "w ");
put(MapColor.ORANGE, "#F9801D ");
@@ -48,6 +61,13 @@ public class WoolTool
}
}
/**
* The method which gets triggered when a player places a carpet, and decides what to do based on the carpet's colour:
* <ul>
* <li>Red - Resets the counter of the colour of wool underneath the carpet (if there is no wool, then nothing happens)</li>
* <li>Green - Prints the contents of the counter of the colour of wool underneath the carpet</li>
* </ul>
*/
public static void carpetPlacedAction(DyeColor color, PlayerEntity placer, BlockPos pos, ServerWorld worldIn)
{
if (!CarpetSettings.carpets)
@@ -112,6 +132,9 @@ public class WoolTool
}
}
/**
* Gets the colour of wool at the position, for hoppers to be able to decide whether to add their items to the global counter.
*/
public static DyeColor getWoolColorAtPosition(World worldIn, BlockPos pos)
{
BlockState state = worldIn.getBlockState(pos);