mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Matter placer
This commit is contained in:
parent
c657ba52ad
commit
930469a006
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("matter-placer")
|
||||
@EqualsAndHashCode()
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents an iris object placer. It places objects.")
|
||||
@Data
|
||||
public class IrisMatterPlacement {
|
||||
|
||||
}
|
@ -31,8 +31,10 @@ import com.volmit.iris.util.documentation.RegionCoordinates;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.function.Consumer4;
|
||||
import com.volmit.iris.util.math.AxisAlignedBB;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.matter.Matter;
|
||||
import com.volmit.iris.util.matter.MatterSlice;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
import com.volmit.iris.util.parallel.HyperLock;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
@ -504,4 +506,13 @@ public class Mantle {
|
||||
public int getLoadedRegionCount() {
|
||||
return loadedRegions.size();
|
||||
}
|
||||
|
||||
public <T> void set(int x, int y, int z, MatterSlice<T> slice) {
|
||||
if(slice.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
slice.iterateSync((xx,yy,zz,t) -> set(x+xx,y+yy,z+zz,t));
|
||||
}
|
||||
}
|
||||
|
60
src/main/java/com/volmit/iris/util/matter/MatterPlacer.java
Normal file
60
src/main/java/com/volmit/iris/util/matter/MatterPlacer.java
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.matter;
|
||||
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
|
||||
public interface MatterPlacer {
|
||||
int getHeight(int x, int z, boolean ignoreFluid);
|
||||
|
||||
Mantle getMantle();
|
||||
|
||||
default <T> void set(int x, int y, int z, T t)
|
||||
{
|
||||
getMantle().set(x,y,z,t);
|
||||
}
|
||||
|
||||
default <T> T get(int x, int y, int z, Class<T> t)
|
||||
{
|
||||
return getMantle().get(x, y, z, t);
|
||||
}
|
||||
|
||||
default void set(int x, int y, int z, Matter matter)
|
||||
{
|
||||
for(MatterSlice<?> i : matter.getSliceMap().values())
|
||||
{
|
||||
set(x, y, z, i);
|
||||
}
|
||||
}
|
||||
|
||||
default <T> void set(int x, int y, int z, MatterSlice<T> slice)
|
||||
{
|
||||
getMantle().set(x, y, z, slice);
|
||||
}
|
||||
|
||||
default int getHeight(int x, int z)
|
||||
{
|
||||
return getHeight(x, z, true);
|
||||
}
|
||||
|
||||
default int getHeightOrFluid(int x, int z)
|
||||
{
|
||||
return getHeight(x, z, false);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user